Info on Smalltalk DSLs or Metaprogramming...

Ramon Leon ramonleon at cox.net
Sun Aug 20 17:20:21 UTC 2006


> In Ruby, "See" could be an object, "spot" a method and "run" a local  
> variable.
> 
> As far as I know, you couldn't interpret the same thing directly in  
> Smalltalk. You would need to write "See spot: run", which is where  the 
> colons become a problem.
> 
> Of course, there are other cases where the colon would come in handy.
> 
> Having thought about both languages a lot over the last few days, I'm  
> pretty sure of the following:
> 
> 1) Regardless of which language you use, there will be DSL elements  
> that appear awkward or clunky (provided you do no string processing).
> 
> 2) Some things will always be easier to write in the other language.
> 
> -Rich-
> 

Ruby might allow parens to be optional allowing run to be sent to spot, 
however, it'd look more like...

See.spot run

Hardly any better than

See spot: run

Besides, you could always setup spot as a member of see, then...

See spot run

Is perfectly valid Smalltalk, just like Ruby's...

See.spot.run

However you work it, I think the Smalltalk will come up with a more 
natural English looking syntax due to it using spaces where ruby would 
use periods and it using periods as a statement separator.

See spot run. Spot go home. Spot wag tail.

Is a perfectly valid Smalltalk statement, can Ruby do that?




More information about the Squeak-dev mailing list