incubator-flex-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Frank Wienberg <fr...@jangaroo.net>
Subject Re: [ASJS] Adjusting FalconJS output (no general discussion in this thread, please)
Date Fri, 07 Dec 2012 12:12:11 GMT
On Fri, Dec 7, 2012 at 10:12 AM, Erik de Bruin <erik@ixsoftware.nl> wrote:

> [#Changes:
> - don't create private vars on the prototype, instead 'create' them in
> the constructor (as this._privateVar), as shown in the example
>
> I'm not sure which example you refer to. But what is the difference, if
you still assign the value to this._privateVar?
The real difference is whether the right-hand side of the assignment is a
constant, immutable value. Then you can safely add the value to the
prototype and even save some memory at runtime (while losing a microsecond
for prototype-chain-lookup). However, if it is a dynamic expression or
evaluated to a mutable object (like e.g. an Array), you have to make sure
that every object instance receives its own fresh instance, and so the
assignment has to be placed in the constructor.

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message