Friday, March 28th, 2008

Composing DSLs in JavaScript

Category: Articles, JavaScript

javascript
< view plain text >
  1. TheRulesAre(function() { with(this) {
  2.  
  3.     a(Player).mayNot('buyProperty').unless(function(player, property) {
  4.         return property.owner === null &&
  5.                 player.funds >= property.price;
  6.     });
  7.  
  8.     a(Property).mayNot('addHouse').when(it().isMortgaged());
  9. }});

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.

Posted by Dion Almaer at 7:27 am
1 Comment

++++-
4.1 rating from 9 votes

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.