cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tony Collen <tcol...@neuagency.com>
Subject Re: Problem with JPetStore
Date Fri, 21 Mar 2003 17:59:37 GMT
On Fri, 21 Mar 2003, Sylvain Wallez wrote:

> Christopher Oliver wrote:
>
> > Sylvain Wallez wrote:
>
>
> <snip/>
>
> >> Does JavaScript, like Java, make a difference between primitive types
> >> (stored by value on the stack) and object types (stored by reference)
> >> ? My understanding after some tests is that a difference is made.
> >
> >
> > No, there shouldn't be any difference. If there is, it's a bug. What
> > was your test?

>From http://www.forerunners.org/WebLibrary/jscript/ch09_03.htm :

 The basic rule in JavaScript is this: primitive types are manipulated by
value, and reference types, as the name suggests, are manipulated by
reference. Numbers and Booleans are primitive types in
JavaScript--primitive because the consist of nothing more than a small
fixed number of bytes, bytes that are very easily manipulated at the low
(primitive) levels of the JavaScript interpreter. On the other hand,
objects and arrays are reference types. These data types can contain
arbitrary numbers of properties or elements, and so can be of arbitrary
size, and cannot be so easily manipulated. Since object and array values
can become quite large, it doesn't make sense to manipulate these types by
value, which could involve the inefficient copying and comparing of large
amounts of memory.

AFAIK, that's just like Java.

Tony



Mime
View raw message