Object.prototype.link

Neil Mix nmix at pandora.com
Sun Feb 22 13:45:35 PST 2009


Can you describe this in terms of language features from another  
language?  For example, the use-case you've provided could be  
accomplished with pointers in C.  In C++ you could create a  
MutableNumber class and use operator overloading.  Is that the kind of  
thing you're looking for?

On Feb 22, 2009, at 1:56 PM, memolus at googlemail.com wrote:

> a and b are properties of object "this" (the global object). It has to
> work the same way like linking "x.a" to "y.b". link(this, "a", this,
> "b") does work with the function of David-Sarah Hopwood.
>
> 2009/2/22 Lasse R.H. Nielsen <atwork at infimum.dk>:
>> On Sat, 21 Feb 2009 18:52:06 +0100, memolus at googlemail.com <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
>>
>> Here you are not linking properties of objects, or values at all,  
>> as your first post seemed to suggest.
>> Instead your are linking *variables* (aliasing).
>>
>> I.e, what you ask for is for link(b,a) to create a new variable,  
>> "b", aliasing the existing variable "a".
>> Is this correct?
>>
>> /L
>> --
>> Lasse R.H. Nielsen
>> 'Faith without judgement merely degrades the spirit divine'
>>
> _______________________________________________
> Es-discuss mailing list
> Es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss



More information about the Es-discuss mailing list