Info on Smalltalk DSLs or Metaprogramming...
Wilkes Joiner
wilkesjoiner at gmail.com
Mon Aug 14 16:55:09 UTC 2006
Here is a blog entry of mine about using the Refactoring Browsers code
to generate classes for me:
http://wilkes.blogspot.com/2005/12/simple-code-generation-in-smalltalk.html
The Behavior>>compile: method will add a new method onto a class.
For instance methods:
MyClass compile: 'someAttribute
^ someAttribute'
For class methods:
MyClass class compile: 'aClassMethod
"Do some stuff"'
On 8/14/06, Rich Warren <rwmlist at gmail.com> wrote:
> Hi,
>
> I've seen several online articles about writing Domain Specific
> Languages in Ruby. All the articles mention that the idea of DSLs
> comes largely from Lisp and Smalltalk. I've found descriptions on
> writing DSLs in Lisp--but I can't seem to find any good references
> for Smalltalk.
>
> Does anyone have any helpful pointers? If I'm going to follow the
> Ruby model, then I need to be able to execute arbitrary strings as
> code (which Compiler evaluate: and related functions seems to
> handle). I also need to be able to add new methods to classes/
> instances at runtime--which I haven't found.
>
> Any help would be greatly appreciated.
>
> -Rich-
>
>
More information about the Squeak-dev
mailing list
|