[self-interest] prototypes, "meta" and reflective programming

cramakrishnan at acm.org cramakrishnan at acm.org
Sat Jan 13 00:08:14 UTC 2001


Jecel Assumpcao Jr writes:
> On Wed, 10 Jan 2001, C. Ramakrishnan wrote:
> > In JavaScript, however, objects are just the same as arrays with the
> > slot names being the index.  So I could have just done:
> > 
> >   myObject[key] = value;
> > 
> > No need for reflection.
> 
> Actually, this alternate representation for objects (you called them
> arrays, but they look more like dictionaries to me) *is* reflection. It
> is just much more "lightweight" than
> 
>       (reflect: myObject) slotAt: key PutValue: value
> 
> or something like that. But it is, in theory, the same thing.

I sort of see where you are coming from.  Would you also say that
Self's inline object defination syntax:

  (|slot1 = foo. slot2 = bar| code)

is a form of lightweight meta-programming?

BTW, I refer to the representation as an array representation because
in JavaScript arrays can have string indices.

- sekhar

--
C. Ramakrishnan        cramakrishnan at acm.org



More information about the Self-interest mailing list