Beginner smalltalk question: Open Classes and Smalltalk
philippe.marschall at gmail.com
Mon Jan 16 20:54:39 UTC 2006
2006/1/16, Rich <rjseagraves at gmail.com>:
> The Ruby language supports the concept of "Open Classs" or that at
> run-time a class can have methods added to it, or in general have it's
> definition modified. As I understand it, the idea for this originally
> came from Smalltalk. If so, how would I go about adding methods (in
> the workspace, for example, just to test things out)? Thanks alot.
I think the closest thing open classes map to are class extensions
(please correct me if I'm wrong). A class extension is a method that
belongs to a different package than the class for which it is defined.
So for example if you want to add a method to String, but it should
belong to MyPackage. The way you do that in Squeak is create the
method in a *MyPackage category in String.
More information about the Squeak-dev