Thursday, October 11, 2012

Crack 0.7.1 released

I'm happy to announce the release of Crack 0.7.1.  This is a minor bugfix release containing the following:
  • We updated the manual for version 0.7.
  • Fixed crack.process to actually use the pipe flags we're passing in.
  • Fixed filehandle cleanup on directory iterators.
  • Fixed a few internal naming and ownership bugs.
In the interest of keeping the 0.7 branch as a stable development platform, I'm going to try to continue to merge bug fixes into the branch and release from it a little more frequently than we have been for the major releases.  We're going to continue to shoot for a 1.0 release around the end of the year.

Monday, September 10, 2012

Crack 0.7 Released

After the release of version 0.6.1 early this year, we were hoping that our next release would be 1.0. Unfortunately, implementing compiled module caching (a featured we deemed critical for 1.0) proved to be more difficult than expected, and we've ended up doing several big coding sprints interspersed with lots of other smaller scale improvements without ever quite making it happen.

We've been trying to release no less frequently than quarterly, but as a result of all of these efforts and our focus on the bigger, 1.0 release, we found ourselves in a position of being well overdue for a release. So now that we've cleared up some really hard bugs, I've taken a break for a few days to release 0.7. The new version features lots of improvements:

  • Switched licensing from LGPLv3 to MPL 2.0.
  • Upgraded to LLVM 3.1
  • Added 16-bit integer types.
  • Added the "alias" statement (a more general replacement for "typedef").
  • Implemented a version of cast that returns a default instead of throwing an exception when the cast fails.
  • Added indented string constants.
  • Added support for virtual methods in extension classes.
  • Added an "assert" annotation.
  • Added extensions for midi, alsa, SDL drawing, fluidsynth and Crossroads IO.
  • Added support for XML parsing.
  • Added an OrderedHashmap collection type.
  • Added support for process multiplexing using Poller. 
  • Lots of bug-fixes and small enhancements.
  • Various changes to support caching (which still doesn't work).
I'm personally quite happy with where the language is at right now, when I write Crack code these days I'm finding myself thinking "damn, that really sucks" only very rarely, possibly less often than when I write Python code and certainly less than when I write Java or C++ code.  So for me, at least, the project is now at the pay-off point: I can say that Crack is my preferred language for general-purpose coding.

That said, we hope you enjoy the new release and find it useful.  We're currently hoping to release 1.0 (with caching, damn it!) by the end of the year, but we're not going to compromise on quality to make it happen.  Our  only guarantee is that when 1.0 comes, it will be unquestionably awesome :-)

Saturday, June 30, 2012

Changing our License to MPL 2.0

As a long-time open source developer, I've always been a big fan of the LGPL. I've always believed it struck the best balance between promoting open source and allowing commercial users who, for whatever reason, may not be willing or able to release their code under the GPL.

But a few months ago, I discovered that part of my understanding of the LGPL was flawed. Specifically, the license does not allow you to statically link a closed source executable to an LGPLed library. Apparently this was a point that was unclear in version 2.0 of the license, but was made more explicit in version 3.0, the version I adopted for Crack.

This isn't a restriction I wanted to impose on users of the language. We discussed the possibility of adding an alternate license that would explicitly allow static linking (apparently gcc does this for portions of its statically linked runtime). But ultimately, rather than complicate our licensing story, we decided to switch to the Mozilla Public License.

MPL 2.0 is classified as a "reciprocal" license. It provides all of the protection to the primary codebase that the GPL would without imposing any requirements on other code that merely links to ours. As compared to the LGPL, I think the one thing it doesn't protect is a user's ability to modify crack libraries independent of a larger system that it is linked into (the case for the LGPL's restrictions), but I care less about this case than that of developers not being able to use the language because of this restriction.

Code in the repository still hasn't been modified to reflect this, I'm going to check these changes in over the next few days.

Thursday, March 22, 2012

Indented strings and struct annotations

I've just checked in support for two new features: indented strings and
struct annotations.

Indented strings allow you to write string constants across multiple lines
without breaking indentation:

    string_val := I'here is a document
                    embedded in a string definition
                        - this line will be indented in the output
                    but the rest will not.';


This would produce the following output:

    here is a document
    embedded in a string definition
        - this line will be indented in the output
    but the rest will not.

In an indented string, the escaped newline also escapes all following

    # string_val = "this is a single line string!"
    string_val := I"this is a \
                    single line string!";

In an indented string (indicated with a capital "I" prefix) the tokenizer
strips all leading whitespace after a newline up to the minimum level of
indentation following a newline for the entire string. Whitespace after an
escaped newline, though ignored in the string itself, is considered in
determining the minimum indentation level. So if you wanted to define a string
containing a list of indented lines, you could do something like this:

    string_val := I'  a) item 1
                      b) item 2
                      c) item 3\

The escaped newline and the whitespace before the final quote will be
ignored, but forces the minimum indentation to two characters before the start
of the previous lines.

This trick also works for i-strings:

    cout I`Hello!

Struct annotations essentially allow you to define a class consisting only of
instance variables with a constructor that allows you to initialize all of the
instance variables. So the Coord example from the manual (defining a two
dimensional coordinate) can now be written like this:

    @import crack.ann struct;

    @struct Coord {
        int x, y;

    c := Coord(10, 20);  # create a Coord with x = 10, y = 20

The struct annotation is still very limited: you can't use inheritance or
define methods, and there are no auto-generated formatTo() or comparison
methods. These niceties will eventually be added. But it's still a worthwhile

Thursday, March 15, 2012

Virtual Functions in Extensions!

This morning I checked in a big change to allow us to do a better job at wrapping C++ classes with virtual functions.  In summary, you can now create an extension class whose virtual methods call the underlying C++ function by default, but can be overriden in Crack as if they were normal Crack virtual methods.  This magic also works from C++: calling the virtual function on a Crack object from C++ transparently dispatches the call to the Crack override, cleanly solving the problem of C++ callbacks.  To top it all off, the interface is portable - it makes no assumptions about the C++ ABI.

You can read the original design doc at  At the time of this writing, this is not completely up-to-date, but test/ includes a complete example.

Happy wrapping!

Friday, January 13, 2012

Crack 0.6.1 released

I'm happy to announce the release of Crack 0.6.1.  The primary feature of this release is that we've ported the system to LLVM 3.0.  There were also a few bug fixes.  Enjoy!