Classes as Sugar is now ready for discussion
Dmitry A. Soshnikov
dmitry.soshnikov at gmail.com
Mon Sep 13 01:38:44 PDT 2010
On 13.09.2010 12:30, Dmitry A. Soshnikov wrote:
> Regarding non-|this|-bounded -- yeah, I think that it's better to use
> exactly a delegation and reuse functions from mixed modules. Despite
> that properties are references to the same objects, augmented (with
> traits or mixins) objects have own properties, that decreases reusing
> (if to remove a function from a trait, it still will be exists in the
> augmented object). Currently, it's easily possible to implement
> delegation based traits/mixins even in ES3 (though, with non-standard
> extenstion such as __proto__ and __noSuchMethod__, for example:
> http://gist.github.com/575982). With using new Proxies (and possibly
> WeakMap) mechanism it's should be possible to implement them for Harmony.
Forgot to notice, the method "extend" which Prototype.js borrowed from
Ruby (as actually all other things Prototype.js borrowed from Ruby,
since this js-framework initially was created as addition for Ruby on
Rails) adapted to browser host-environment and for to be cross-browser,
uses /static augmentation /of objects. However, in Ruby this "extend"
method uses exactly delegation to the mixed module (that is, if a some
function is added to the module, it automatically available from the
object to which this module is mixed). I.e. extend/include just adds
such mechanism, I'm sure that Prototype.js's "extend" would be created
also as delegated non-|this|-bounded function.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss