[Newbies] getters, setters, attr?

itsme213 itsme213 at hotmail.com
Fri Sep 8 03:20:32 UTC 2006

One important difference: in Ruby you are using a mini-DSL. Remove or rename 
the attr... and the getters and setters follow. In Squeak once you generate 
the accessors you deal with them individually. So if you remove the instance 
variable, you have to manually remove the accessors.

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.

You could step these up to Active-Record like DSLs (Magritte does equivalent 
  add_attribute: name :rw aBoolean multiple: aBoolean inverse: aName

My (naive) understanding is that somehow this DSL-like style does not appear 
to have become popular in the Smalltalk world. Is that true?

----- Original Message ----- 
From: "Bert Freudenberg" <bert at freudenbergs.de>
To: "A friendly place to get answers to even the most basic questions 
aboutSqueak." <beginners at lists.squeakfoundation.org>
Sent: Thursday, September 07, 2006 2:14 PM
Subject: Re: [Newbies] getters, setters, attr?

> Steve Moffitt schrieb:
>> Hi David
>> You can download the RefactoryBrowser from squeakmap or you can download 
>> and install the refactoryengine from 
>> http://squeaksource.com/@ehoWsqHVuXjcUYEx/wpgyyYAP.
>> If you look at the menu from the second top pane ( the class pane ) in 
>> the browser the submenu under instance variables will create accessors 
>> for you.
> That's in the regular browser, too, in the class's shifted context menu.
> - Bert -
> _______________________________________________
> Beginners mailing list
> Beginners at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/mailman/listinfo/beginners

More information about the Beginners mailing list