CoffeeScript, it could be a great story, but...

Oh yeah, CoffeeScript is nice and sexy, it allows to write javascript quickly, but...

It's missing some important features I need for KaraCos implementation.

Context :
KaraCos exposes node objects from a node tree on top of the HTTP protocol.
Some object methods can be accessed from HTTP using a REST API. Each node can expose a WSDL or equivalent.
KaraCos dynamically assign an object type to a Node from one of it's attribute in the content repository.
To achieve such task, i used in Python some metaclass, so i could assing a particular type of 'class' to a déclared class, and then trigger some internal action at class declaration (registering the type as a data-linked type then gives the db wrapper a registry to allow him to choose corresponding class).

This META programming aspect is missing from coffee, let's watch the coffeescript example of class and it's generated part :

Look at how class Animal is converted to js, my need is to add some treatment just before the return Animal statement. From the example of python, metaclass allows as well to wrap class constructor with some generic function.

Today there is no way for a CoffeeScript programmer to achieve metaprogramming. I'm right now studying the coffee anotated source to find how i could extend it a bit, but this is my first compiler experience. Hopefully, @FredZen gives me some help, are there any other volunteer for such a challenge ?

CoffeeScript will then look much more appropriate (and flexible), don't you think ?

Aucun commentaire: