Info on Smalltalk DSLs or Metaprogramming...

Rich Warren rwmlist at gmail.com
Thu Aug 17 01:55:55 UTC 2006


In my tests, I've noticed that Behavior>>compile: actually changes  
the image. Is there any way to make less-permanent changes (e.g. just  
changing a single instance)?

-Rich-


On Aug 14, 2006, at 6:55 AM, Wilkes Joiner wrote:

> 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