instances that know #new, and Perl OO
Jecel Assumpcao Jr
jecel at merlintec.com
Tue May 20 17:26:18 UTC 2003
On Tuesday 20 May 2003 06:26, Andreas Raab wrote:
> > Apparently, as an aside, I'm told that VisualWorks experimented
> > with adding:
> >
> > Object>>new
> >
> > self species new
> >
> > But that was later removed, apparently. Ugh. That hack just looks
> > trouble waiting to happen. :)
>
> It depends on how you look at it. If you assume that each object is
> an exemplar for its class (e.g., sort of a prototype) then it makes
> perfect sense. I'd expect that most people simply couldn't get used
> to it because they're focused on a 'class oriented' rather than an
> 'object oriented' system.
But in the above code the particular instance receiving the #new message
is not acting as a prototype. None of its instance variables have their
values transmitted to the new object.
Prototype based languages like Self, Slate, Kevo and Newtonscript always
used #clone or #copy to create new objects from existing ones. That is
probably the case for Omega, Io and all the rest as well, though I am
no sure about that.
In any case it seems a bad idea to say "new" when you mean "copy".
-- Jecel
More information about the Squeak-dev
mailing list
|