reflection (was: embedding based prototype languages)
Jecel Assumpcao Jr
jecel at merlintec.com
Fri Nov 8 22:18:03 UTC 2002
On Friday 08 November 2002 17:35, James McCartney wrote:
> In Self this operation is considered reflective, but I'm not sure
> why. I would consider assigning methods to slots to be a normal kind
> of operation. It is a more specific way to change behaviour than
> dynamic inheritance via assigning parents, which I would think would
> be the more reflective operation.
Methods are considered constants in Self. If I have an object like this:
( | a <- 3. b = 4 | )
then changing the value of "a" can be done with a simple message send
and is considered "normal programming", while changing the value of "b"
requires either a primitive (_AddSlots:) or using a mirror on this
object, either of which would be considered "meta programming".
So though both "a" and "b" can be changed, having to programmer
explicitly give the system a tip about how they probably will be used
allows the compiler to do a better job. So does having all method slots
be constant.
One change in Self 4.1.6 compared to previous releases is that now you
have the option of storing method objects in data slots.
One complication of having assignable method slots is that though
assignment is unambiguous enough, what happens when you read from the
slot? Do you get the method object as the result or is the method
automatically executed? No matter which one you choose as the default,
you will need a special scheme for the other.
In another email James McCartney wrote:
> But those authors pack their tables in the paper I read. In fact I use
> exactly their selector based row displacement packing technique in my
> own vm.
The paper I mentioned can be found at
http://www.cs.ucsb.edu/labs/oocsb/papers.shtml
though for some reason I can't access that right now.
All compression schemes require you to add some extra tests to your
dispatch sequence. Normally it is well worth it. But I have a machine
running at 57MHz with lots of extra memory that I can't otherwise use,
so I don't compress.
-- Jecel
More information about the Self-interest
mailing list