Hi David,

I don't know the shared scope model at all and can't answer on this
therefore only a remark:

var x = 2.0

won't involve a NativeNumber. NativeNumber are for Number objects, not
for Number primitives.

Cheers,
Marc.
-- 
Web: http://www.efficient-webtesting.com
Blog: http://mguillem.wordpress.com

David Parks wrote:
> I hope I'm not overdoing it with questions, but can someone just verify my
> understanding of this concept:
> 
> I am looking at all of the Native* classes (NativeArray, NativeNumber,
> NativeString, NativeFunction, etc).
> 
> If I have a shared scope model in which I load all standard objects via
> initStandardObjects() into the root scope, then execute scripts in the
> instance scope (shown below):
> 
>              Instance_Scope_A
>            /   
> Root_Scope - Instance_Scope_B
>            \
>              Instance_Scope_C
> 
> My understanding is that when a script in Instance_Scope_A, for example,
> executes "var x = 2.0", that the class NativeNumber is being called; and
> this class is then responsible for adding a java.lang.Double into
> Instance_Scope_A's attribute bucket (I use "bucket" for lack of the proper
> term).
> 
> What is not happening (if I understand it correctly) is that an instance of
> NativeNumber is being instantiated with a value of 2.0 and being stored in
> Instance_Scope_A as an instance of org.apache.javascript.NativeNumber.
> 
> If I am indeed wrong, and the latter option is occurring, then is there a
> way that I can access the NativeNumber object rather than getting a
> java.lang.Double back as I do from ScriptableObject.get(String,Scriptable)?
> 
> I'm trying to find a good solution for tracking references to JS objects,
> and the latter scenario would have allowed me to do so elegantly (by simply
> adding a counter to ScriptableObject), that's why I to verify my
> understanding of this detail.
> 
> Thanks!
> David
> 
> 
> 
_______________________________________________
dev-tech-js-engine-rhino mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino

Reply via email to