Alternative syntax for <|
Dmitry Soshnikov
dmitry.soshnikov at gmail.com
Wed Nov 16 11:16:09 PST 2011
On 16.11.2011 23:12, Erik Arvidsson wrote:
> One thing that all of these discussions are missing is the hoisting
> property of function and any possible future classes. If we use "let
> Point = ..." we lose all hoisting and the order of your declarations
> starts to matter and we will end up in the C mess where forward
> references do not work.
>
No matter, we may rewrite it with `var':
// parent object
var point = {x: 10, y: 20};
// child object
var point3D extends point {
z: 30
}
// a class
class Point3D extends Point {
constructor (x, y, z) { ... }
}
It seems interesting for me, since we define both -- child classes and
child objects with the same syntactic construction; only `var' and
`class' keywords change.
Dmitry.
More information about the es-discuss
mailing list