Object.prototype.link

David-Sarah Hopwood david.hopwood at industrial-designers.co.uk
Sun Feb 22 06:01:03 PST 2009


David-Sarah Hopwood wrote:
> memolus at googlemail.com wrote:
>> I'd like to use link(obj, target).
>>
>> E.g.
>> a = 10;
>> link(b, a);
>> a++;
>> b++;
>> print(b);
>> // output: 12
> 
> That would require a "catchall" mechanism, allowing accesses to
> nonexistent properties of an object to be handled. It's quite likely
> that such a mechanism will be added, I think, but there is currently
> no detailed concrete proposal.

Sorry, I misread your example; a catchall mechanism is not particularly
relevant to it.

What you've asked for above can be implemented in terms of "linking" of
properties using getters/setters, in the case where the variables are in
the global scope or in a scope introduced using 'with'. However, why on
earth would you want this? It looks frightful.

-- 
David-Sarah Hopwood ⚥



More information about the Es-discuss mailing list