This project is archived and is in readonly mode.

#959 ✓invalid

Class Mutators should run before all else

Reported by Arieh | August 11th, 2010 @ 01:19 PM | in 2.0 (closed)

This is something i ran into when trying to dynamically create parameters for the Class constructor - the Object passed to the Class constructor is iterated by it's order. This means that if Extends isn't the first in it's Hash, it will overwrite whatever comes before him. A simple test case -

After some debugging I've found the problem in the Class.implement (core:1214). It simply iterates the Object. IMO - it should first look for mutators, and only then iterate over the rest.

a possible solution could be doing an extra iteration if key is an object (the first check in Class.implement); something like:

if ($type(key) == 'object'){

for (var p in key) if (p in Class.Mutators){
    Class.Mutators[p].call(this, key[p]);
    delete key[p];
for (var p in key) this.implement(p, key[p]);
return this;


Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

Shared Ticket Bins