[Newbies] getters, setters, attr?

David Pollak dpp at athena.com
Mon Sep 11 18:28:19 UTC 2006


Thank you all for your help!

On Sep 8, 2006, at 8:25 AM, Ramon Leon wrote:

>> My (naive) understanding is that somehow this DSL-like style
>> does not appear to have become popular in the Smalltalk
>> world. Is that true?
>
> That's because this style relies on the fact that Ruby programs are  
> text, in
> a file, that get's run to create a live environment.  During this  
> run phase,
> those call's expand into getters and setters, similar to Lisp  
> macro's.  By
> contrast, Smalltalk is always running, you aren't editing text  
> files, you're
> editing the live objects directly, essentially the expanded form in
> Ruby/Lisp terms.  So this style doesn't really suit Smalltalk.
>
> Smalltalkers would handle dynamic getters and setters by hacking
> doesNotUnderstand: and checking a local dictionary for the prop, like
> ActiveRecord does, something like...
>
> doesNotUnderstand: aMessage
>     ^self properties at: aMessage selector
>         ifAbsent: [super doesNotUnderstand: aMessage]
>
> _______________________________________________
> Beginners mailing list
> Beginners at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/mailman/listinfo/beginners




More information about the Beginners mailing list