Info on Smalltalk DSLs or Metaprogramming...

Ramon Leon ramon.leon at allresnet.com
Fri Aug 18 16:28:15 UTC 2006


> -----Original Message-----
> From: squeak-dev-bounces at lists.squeakfoundation.org 
> [mailto:squeak-dev-bounces at lists.squeakfoundation.org] On 
> Behalf Of Rich Warren
> Sent: Friday, August 18, 2006 4:35 AM
> To: The general-purpose Squeak developers list
> Subject: Re: Info on Smalltalk DSLs or Metaprogramming...
> 
> Of course, the best ideas always come after I hit the send button.
> 
> It dawned on me that I could always preprocess the incoming 
> string on either platform. A relatively trivial amount of 
> code means I could write the (now case insensitive) DSL as:
> 
> name: my name, id: 0, number of agents: 200, target function:  
> 30sphere, maximum error: 1e-10, visualize
> 
> And have it converted into a simple format for either platform:
> 
> 
> TrialRun new;  name: 'my name'; id: 0; numberOfAgents: 200;
> targetFunction: #30sphere; error: 1e-10; visualize: true
> 

Seems to me the difference between 

name: my name, id: 0, number of agents: 200, target function: 30sphere,
maximum error: 1e-10, visualize

And this

TrialRun name: 'my name'; id: 0; numberOfAgents: 200; targetFunction:
#30sphere; error: 1e-10; visualize: true

Are so trivial, why bother with the parsing step at all, just use direct
Smalltalk syntax, if kids can learn Smalltalk, so can users of a DSL.  As
far as samples of DSL's go, I use one daily in the Seaside framework for
generating html http://www.seaside.st/Documentation/GeneratingHTML/, and
another http://scriptaculous.seasidehosting.st/, for generating JavaScript.
Both I think are good examples of embedded DSL's in Smalltalk in daily use.




More information about the Squeak-dev mailing list