Any reason template string with empty interpolation placeholder (`${}`) throws?

Mark S. Miller erights at google.com
Thu Oct 22 23:05:29 UTC 2015


It is an unnecessary special case. The empty string is a valid statement
(aside from the semicolon) but not a valid expression. The syntax of what
appears between the curlies is expression.

Having it default to the empty string makes no sense. Why not 0, false,
null, or undefined? Remember that template strings can be used to make
arbitrary objects using any DSL that your tag knows how to parse. There's
nothing about template strings that is about strings in either the
substitution values or the result values.

If you want the equivalent of `${''}`, just say `${''}`.



On Thu, Oct 22, 2015 at 6:31 PM, Caitlin Potter <caitpotter88 at gmail.com>
wrote:

>
> Doesn't necessarily seem like a bad idea. I could be on board with that.
>
> > On Oct 22, 2015, at 6:18 PM, Mohsen Azimi <me at azimi.me> wrote:
> >
> > Pardon my lack of use of proper terminology.
> >
> > This is kind of annoying working with large template strings. When I
> leave an interpolation placeholder(what's the right name?) empty it blows
> up all my code.
> >
> > Can it be forgiving like Ruby and CoffeScript and just replace it with
> empty string?
> > _______________________________________________
> > es-discuss mailing list
> > es-discuss at mozilla.org
> > https://mail.mozilla.org/listinfo/es-discuss
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>



-- 
    Cheers,
    --MarkM
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20151022/32b7250f/attachment-0001.html>


More information about the es-discuss mailing list