I've been reading a lot of nicely written JS in the Traceur compiler.
They use a very conservative Java-like approach with Constructor
functions and literal prototype property declarations. Sadly they must
include workarounds for Object.create:

http://code.google.com/p/traceur-compiler/source/browse/src/traceur.js#80

WebInspector has a bit more rough and ready JS style, eg

WebInspector.View.prototype.__proto__ = WebInspector.Object.prototype;

Here's the irony: we can change the WebInspector code to use
Object.create() specifically because they do not use object literal
declarations for functions (and thus one line will make improvement).

Since es-discuss seems quite keen on object literals, a couple of
small improvements would help code move in your direction:

  A version of Object.create() that takes an object RHS.

  Object.merge() that merges the own non-function properties as own
properties, the non-built-in-functions as prototype properties. (a
compromise of the two common versions of extend, own and 'in'
versions).

jjb
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to