The LFC in several places uses the idiom of smashing an object's __proto__ to another object as an 'efficient' way of merging dictionaries. There are two issues with this:
1) Standard ECMAscript provides no way to change your prototype after the fact 2) You can't use hasOwnProperty for `containsKey` We can often work around 1 because often the smashing happens when creating a new empty dictionary that inherits. 2 is important because using `in` for `containsKey` will erroneously make it appear that all your dictionaries contain 'toString', 'value', and other properties of Object.prototype. I'd like to propose we define an LzDictionary class with methods containsKey, get, put, addAll, etc. and use that instead. This will make our code more portable (although there will be some overhead). My only fear is that there is some expectation that setters in particular depend on actually inheriting from the parent class, that you are allowed to dynamically add a setter to a base class and have it show up in all derived classes. Is this so? (There is __proto__ magic in attrs and default attrs too with merging of Array attributes and inheriting of Object attributes. Does this inheritance need to happen too, or is merging sufficient? _______________________________________________ Laszlo-dev mailing list [email protected] http://www.openlaszlo.org/mailman/listinfo/laszlo-dev
