Determine if a value is Callable/Constructible

Kevin Smith zenparsing at gmail.com
Mon Mar 30 16:20:20 UTC 2015


>
> I like the idea of a special syntactic form a lot. One of the nice things
> about `constructor` is that it's easy to explain "you [[Construct]] with
> the constructor". We can't use `call` similarly any more, but I totally
> agree something like it would be pretty nice.
>

Unfortunately, we can't use a magic method name.  Just to throw out a
couple of other ideas though:

Parens sans method name:

    class C {
      constructor() { /* new me */ }
      () { /* call me */ }
    }

Contextual keyword after constructor:

    class C {
      constructor() { /* new me */ }
      constructor call() { /* call me */ }
    }

With a "dot" instead:

    class C {
      constructor() { /* new me */ }
      constructor.call() { /* call me */ }
    }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20150330/d273257b/attachment.html>


More information about the es-discuss mailing list