Proposal: Add `NoSubstitutionTemplate` to `StringLiteral` Definition

Isiah Meadows isiahmeadows at gmail.com
Wed Jan 9 20:47:49 UTC 2019


The first argument to each is an array of items. It's the same per
lexical occurrence, but it's *not* the same across multiple lexical
templates, even if they represent the same sequence of characters with
interpolation expressions removed. That above expression is
semantically more like this: `id(Object.assign(["abc"], {raw: "abc}))
=== id(Object.assign(["abc"], {raw: "abc}))`, which obviously should
evaluate to `false`.

-----

Isiah Meadows
contact at isiahmeadows.com
www.isiahmeadows.com

On Wed, Jan 9, 2019 at 2:49 PM T.J. Crowder
<tj.crowder at farsightsoftware.com> wrote:
>
> On Wed, Jan 9, 2019 at 7:40 PM Andrea Giammarchi
> <andrea.giammarchi at gmail.com> wrote:
> > I dare saying tags are another issue here, 'cause "abc" === "abc",
> >  and with an identity function such `const id = o => o`,
> > `id("abc") === id("abc")` but due latest changes to template
> > literals, id`abc` !== id`abc` so it's easily misleading in the
> > tagged case.
>
> Very good point, but at least tagging is its own thing.
>
> What "recent changes" are you referring to? Surely
>
> ```js
> id`abc` === id`abc`
> ```
>
> with that version of `id` was always `false`? You can't reuse the
> array from the first call to call the tag function the second time,
> what if the function modified the array? (Presumably if it *is* a
> change, that's *why* it was changed... :- ) )
>
> -- T.J. Crowder
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss


More information about the es-discuss mailing list