Friday, March 28th, 2008
Composing DSLs in JavaScript
-
-
TheRulesAre(function() { with(this) {
-
-
a(Player).mayNot('buyProperty').unless(function(player, property) {
-
return property.owner === null &&
-
player.funds>= property.price;
-
});
-
-
a(Property).mayNot('addHouse').when(it().isMortgaged());
-
}});
-
Composing DSLs in JavaScript is James Coglan's latest perusal into fun with JavaScript and DSLs.
He walks through the building of this DSL in a step by step manner. He uses his JS.Class library, but you could of course substitute your favourite JavaScript library.








Apparently it’s Domain Specific Language (http://ajaxian.com/archives/metaprogramming-dsl-javascript-presentation) rather than Dual Super Lead, or Digital Subscriber Line etc etc