Lexically Scoped Object Extensions (was About private names)

Erik Arvidsson erik.arvidsson at gmail.com
Tue Mar 22 10:27:49 PDT 2011


On Tue, Mar 22, 2011 at 08:27, Allen Wirfs-Brock <allen at wirfs-brock.com> wrote:
> I think a more precise statement is you can't do this with private names alone.
>
> As the classbox work explains, you also have to have a modified property lookup algorithm that takes into account that a [[Get]] may be satisfied based upon either the global or local key value associated with the name .  This was reflected in by counter example where I explicitly delegated to the public named property if it exists:

I was not aware of the classbox paper unitl yesterday. It looks very
promising. Instead this was based on C# extension methods as well as
on ES4 namespaces to some degree.

Just like for the classbox paper, property lookup is now also
dependent on lexical scope. To ensure that the property lookup does
not get slowed down too much it is important that this can be
determined statically. Also, we believe that this should be limited to
module scope to reduce the overhead even more.

The actual extension properties would probably be stored as a side
table (using something like soft fields) and it is important that
these extensions can work on frozen objects so that one could extend
frozen primordials.

-- 
erik


More information about the es-discuss mailing list