Cool Boo: Code Generation Inside the Languague

time to read 2 min | 319 words

Here is one more case where an open compiler architecture is a huge plus.

At Mario has created an addin to Boo that gives you the ability to generate from insdie the lagnauge, this one has huge implications. I can see it as a cool way to create mixins. You code use it like this:

[InjectCode(MixinCodeBuilder, "Mixins\Taggable.mixin")]
public class Blog:
    [Property] name as string

# Mixins\Taggalbe.mixin
Implements: ITaggable
          # get tags

The result of this operation is that the Blog class would implement the ITaggable interface, and all the methods and properties that are specified in the mixin files will be enetered into the Blog class during the compilation process.

This mean that you can (even fromt he Blog class, to treat it as if it implemented ITaggable.

Now that is cool