Well, I guess the question is where the init functions would be called.

My idea was that the “instance init function call would be added to the 
constructor as the first thing that happens (with the exception of calling init 
on the super-class first).

The class initializers is more of a question. I figured that might need to be 
added into whatever code loads the js files.

On Jul 18, 2016, at 8:59 AM, Alex Harui <aha...@adobe.com> wrote:

> 
> 
> On 7/17/16, 10:51 PM, "Harbs" <harbs.li...@gmail.com> wrote:
> 
>> A number of reasons:
>> 1. performance
>> 2. If the code does calculations which might change later on
>> 3. If it needs to always reference the same object, you don’t want it
>> reassigned.
> 
> But who would call it more than once?
> 
>> 
>> For instance initialization, you need to setup your prototype only once,
>> or bad things could happen — and the bas class’ prototype needs to be
>> setup first.
> 
> IMO, the prototype is not the instance.
> 
>> 
>> As far as initializing vs constructor goes:
>> 
>> The prototype of the superclass needs to be defined first, but
>> initialization code in the super-class' constructor might need to be run
>> second.
> 
> I think I would need to see actual code examples for these scenarios in
> order to understand when the order of constructors needs to be controlled.
> 
> -Alex
> 

Reply via email to