JavaScript objects, primitive values, and properties are all very different,
and should
be explained well in good JavaScript books.  The simplest way to achieve
what you
want (two variables aliased to the same information) is:

var a = new Object();
var b = a
// a and b point to the same object.  That object's properties can be
created and changed.
a.x = 3;
// b.x == 3 and a.x == 3
b.x = 5;
// b.x == 5 and a.x == 5

Only a property of an object can be changed without changing the object's
identity.
Two variables or properties can point to the same object.

Hope this helps,
Bill Hesse

On Wed, Feb 18, 2009 at 11:08 PM, Jan de M. <[email protected]> wrote:

>
> Hello,
>
> First, thanks for creating this great engine. I am evaluating using it
> for one of my projects, so I started reading the source and I could
> figure out most things myself, but I still don't quite understand how
> variables, values and objects relate to each other. See this code, for
> example:
>
> var a = 0;
> var b = 1;
>
> This creates two locals, but is there any mapping from variable to
> memory address? I found the SymbolTable class but I don't see how it
> is used here. For example, would it be possible to let a point to the
> exact same memory location (object) as b?
>
> Any help would be appreciated.
>
> Jan
> >
>


-- 
We can IMAGINE what is not

--~--~---------~--~----~------------~-------~--~----~
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
-~----------~----~----~----~------~----~------~--~---

Reply via email to