Alternative syntax for <|
Dmitry Soshnikov
dmitry.soshnikov at gmail.com
Wed Nov 16 11:34:51 PST 2011
But why do we need new keyword?
Actually, I can accept a new keyword in case if reasons will really be
serious. But in this case -- `extends' may fit quite nice.
P.S.: In general, it's just funny picture. Somehow ES4 made nice classes
with nice syntax. Why (Why Y NO?) now we invent some scary things such
as const Point = Point <| {}.constructor.{}.prototype{}. Just... why?
What has happened with syntax idea even from ES4?
Dmitry.
On 16.11.2011 23:31, Rick Waldron wrote:
> As stated previously[1], my support for "begets" as pure win is
> unwavering.
>
>
> Rick
>
> [1] https://mail.mozilla.org/pipermail/es-discuss/2011-October/017758.html
>
>
>
>
> On Wed, Nov 16, 2011 at 2:16 PM, Dmitry Soshnikov
> <dmitry.soshnikov at gmail.com <mailto:dmitry.soshnikov at gmail.com>> wrote:
>
> 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.
>
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org <mailto:es-discuss at mozilla.org>
> https://mail.mozilla.org/listinfo/es-discuss
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20111116/39ee8e4e/attachment-0001.html>
More information about the es-discuss
mailing list