how to delay interpolation of template strings?

Andrea Giammarchi andrea.giammarchi at gmail.com
Tue Dec 16 09:35:02 PST 2014


once you pass an object, can you tell me why the suggested gist would not
work?

You don't want scope lookup in your strings because coming from elsewhere,
and you want to pass an object.

So what is exactly the issue with 'Hello ${first_name}'.template({first_name:
"John"}) ?

Is it because it's in the prototype? You are not going to for/in a string
(I hope) anyway ... but if that's the issue you can always grab the code
and make it a `template` function, right ?

it's WTFPL code, go ahead!

OT this back-tick thing will mess up quite a bit on markdown ... oh well ...

On Tue, Dec 16, 2014 at 5:18 PM, Matthew Robb <matthewwrobb at gmail.com>
wrote:
>
>
> On Tue, Dec 16, 2014 at 12:03 PM, Claude Pache <claude.pache at gmail.com>
> wrote:
>>
>> I guess you want sugar for the following valid ES6 code?
>
>
> ​You're right, I must be crazy for wanting my code to be readable and
> slightly resemble the syntax people have been using as defacto-standard for
> years now. I, and I am sure the greater web dev community, much prefer new
> language features to be completely foreign and difficult to make sense of
> in relation to what's already being done.
>
> I don't mean to be snarky about it (and I apologize, I mean no offense)
> but sheesh... Aren't things like async-functions sugar for existing valid
> es6 code? Maybe it would be better if what gets passed to a template
> tag-function is not, by default, the values from the local-bindings.
> Perhaps there is a way to make template tags much more useful by allowing
> the function to determine more about the semantics of the string.
>
> Sometimes this list really does make me think I am crazy or something.
>
> - Matthew Robb
>
> _______________________________________________
> es-discuss mailing list
> 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/20141216/15b209b6/attachment.html>


More information about the es-discuss mailing list