Two simple Self questions and one Self design philosophy query
Ben Moseley
ben_moseley at mac.com
Wed Jun 16 18:59:19 UTC 2004
Hi,
(Apologies if these are somewhat naive - I'm very new to the Self
world, but intrigued...)
The first simple question is - suppose I have an object representing a
table which has four slots to four other objects representing its
legs. If I send a "copy" message to this I will by default get a new
table which shares the legs of the old one (ie - it is a shallow copy).
What is the standard Self idiom for achieving the desired affect? Is it
to implement a custom "copy" method?
The second simple question: Why does "parent* = traits clonable" work
on a new - empty - object when initially "traits" can't be found. (By
this I mean if I have a parent-less object and type "traits" or "traits
clonable" into its evaluator, I get a debugger). There is obviously
some boot-strapping going on here - ie the "traits clonable" which is
used for the parent slot assignment is being evaluated in a different
environment (one which has access to the lobby?) - I was just wondering
how it worked.
Finally, Self makes a clear distinction between prototypes which are
copied (but not inherited from) and traits objects which can be used
for inheritance whereas some other prototype languages merge the two
concepts (ie they inherit via their prototypes by default). I know one
of the original reasons given for the Self approach was to ensure that
the prototype object was genuinely a prototype of objects cloned from
it and not special in any way, but I am curious if with hindsight this
is viewed to be a strength or a weakness of Self. (If this has been
discussed elsewhere I'd be very grateful for pointers).
Thanks very much,
--Ben
More information about the Self-interest
mailing list