[Newbies] getters, setters, attr?

itsme213 itsme213 at hotmail.com
Fri Sep 8 17:17:16 UTC 2006


> So this style doesn't really suit Smalltalk.

I was referring to the image-based equivalent I had outlined ...

  Since you are in an image-based world with Squeak, a solution closer to 
Ruby
  would be to extend Class with methods like
    add_attribute: name rw: aBoolean
    remove_attribute: name
  and invoke these directly on the appropriate classes. I suppose you can 
also
  extend the environment to put these onto menus.

Whether add_attribute and remove_attribute use an #attribute_dictionary on 
the class and key off #doesNotUnderstand, or dynamically add/remove real 
accessor methods, could be a separate design decision.

My (naive :-) understanding is that this kind of dsl-ish enhancement is not 
commonly used in the smalltalk world. e.g. I could not find anything in 
squeak-map to automate simple things like maintaining relations / inverse 
pointers between objects. I'd be quite glad to be wrong ...




More information about the Beginners mailing list