Thanks
--
View this message in context: http://www.nabble.com/SpiderMonkey%3A-working-with-aliases-t1197446.html#a3158517
Sent from the Mozilla - JavaScript Engine forum at Nabble.com.
Can you define "alias"? ECMA-262 Edition 3 does not, except arguably
when talking about the arguments object and the formal parameters that
can be set using arguments[0] for formal parameter a in function f(a) {
arguments[0] = 42; return a }, e.g.
Anyway, the API is not going to change, so you can use the deprecated
entry points. But I'm curious to learn more about your use-case.
/be
It sounds more like plain old reference types (Java or JS), where the
properties that alias the reference could be permanent and readonly. In
that case, you cannot distinguish whether the value storage *that
contains the reference* to the object (which is stored elsewhere) is
shared for the two properties, or is duplicated (but each value slot is
immutable, both always refer to the same object).
So you don't need aliases to take advantage of object's status as a
"reference type". You just need readonly and permanent attributes.
> and is exactly what
> is written on JS_AliasProperty description.
No, joined function objects are something else again.
> The problem is - I cannot found
> a way to delete alias (created with JS_AliasProperty) without deletion of
> aliased object.
You can't delete an object -- objects are garbage collected, delete is a
property removal operator. Again, the property's value is a *reference*
to the object, not the object itself.
/be
It sounds more like plain old reference types (Java or JS), where the
properties that alias the reference could be permanent and readonly. In
that case, you cannot distinguish whether the value storage *that
contains the reference* to the object (which is stored elsewhere) is
shared for the two properties, or is duplicated (but each value slot is
immutable, both always refer to the same object).
So you don't need aliases to take advantage of object's status as a
"reference type". You just need readonly and permanent attributes.
> and is exactly what
> is written on JS_AliasProperty description.
No, joined function objects are something else again.
> The problem is - I cannot found
> a way to delete alias (created with JS_AliasProperty) without deletion of
> aliased object.
You can't delete an object -- objects are garbage collected, delete is a