BAM Weblog

Roy - Breaking Changes

Brian McKenna — 2012-03-11

I’ve made some breaking changes to Roy. The first is changing the grammar to use less parentheses. Before, you had to write:

if (not true) then (id 100) else (10 - 1)

Now you can write:

if not true then id 100 else 10 - 1

The problem is you can no longer do things like this:

if true then if true then true else false else false

But instead have to write:

if true then (if true then true else false) else false

Seems like a good trade-off to me.

The other breaking change is on the modules branch. I’ve decided to make tags be typed and compiled to normal JavaScript function calls. This is possible with a really cool JavaScript trick:

var C = function() {
    if(!(this instanceof C)) {
        return new C();
    }
};

The above code allows the construction of C from JavaScript with either C() or new C().

But this breaks nullary tags, which must now be called with empty parens (just like nullary, external JavaScript functions):

let c = C ()

I’ve been making this change to unify the concepts of tags and functions for module loading. I’ve also been able to remove a heap of mutable state in doing so.

I’ll hopefully be able to merge in the modules branch very soon.

Please enable JavaScript to view the comments powered by Disqus.