Activate your free membership today | Log-in

Friday, March 28th, 2008

Composing DSLs in JavaScript

Category: Articles, JavaScript

>PLAIN TEXT
JAVASCRIPT:
  1.  
  2. TheRulesAre(function() { with(this) {
  3.  
  4.     a(Player).mayNot('buyProperty').unless(function(player, property) {
  5.         return property.owner === null &&
  6.                 player.funds>= property.price;
  7.     });
  8.  
  9.     a(Property).mayNot('addHouse').when(it().isMortgaged());
  10. }});
  11.  

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.

Related Content:

1 Comment »

Comments feed TrackBack URI

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

Comment by Dave Crighton — March 28, 2008

Leave a comment

You must be logged in to post a comment.