Tagged Template literals exist:

<
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals#Tagged_template_literals
>

On Wed, Jul 5, 2017 at 2:03 PM, kdex <[email protected]> wrote:

> … which I would be very happy to discuss, nonetheless.
> It's indeed a little painful to work with derived built-ins if you can't
> use
> literals.
>
> Could we maybe have a syntax that, for its current block, declares how to
> interpret literals? Maybe something along the lines of:
>
> ```js
> class MyArray extends Array {};
> Array as MyArray;
> const array = [1, 2, 3];
> assert(array instanceof MyArray);
> ```
>
> On Wednesday, July 5, 2017 8:47:53 PM CEST kdex wrote:
> > Overriding literals with a derived class is an entirely different
> problem.
> > :)
> > On Wednesday, July 5, 2017 8:42:39 PM CEST Boris Cherny wrote:
> > > I tried that approach, but it doesn’t work when creating objects via
> > > literal notation ([], {}). A bit clumsy to have to write “new
> > > Array(1,2,3)", or “Array(1,2,3)” every time.
> > > _______________________________________________ es-discuss mailing
> list
> > > [email protected]
> > > https://mail.mozilla.org/listinfo/es-discuss
>
> _______________________________________________
> es-discuss mailing list
> [email protected]
> https://mail.mozilla.org/listinfo/es-discuss
>
>
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to