Do-Expressions are still floating around Stage 0, there’s no guarantee that 
they will be incorporated into the language.

The feature is implemented in v8 behind a flag, and can be used in Chrome 
Canary by launching the browser with `—js-flags=“—harmony-do-expressions”`, 
which would enable you to try it out.

**INTERMISSION — Slightly more on-topic portion of post follows after a short 
coffee break**

However, to answer your question, you can implement an 
immediately-invoked-function-expression, like this:

```js
`Hello ${_ => {
  if (a == 2) {
    console.log(‘world’);
  }
}()}`;
```

So this wouldn’t depend on the Do-Expressions proposal, and wouldn’t require a 
keyword per se, although you’d still have some extra tokens making things a bit 
harder to read.

It’s unlikely that the grammar would be changed to accommodate this use case, 
given that people are using template literals already, and the use-case is 
already supported by other means.

> On Jan 10, 2016, at 9:23 PM, Manuel Di Iorio <[email protected]> wrote:
> 
> Hi, I asked around and somebody said that there will be the possibility to 
> execute arbitrary code inside the template tags, using the 'do' keyword in 
> this example way:
> 
>    `Hello ${ do if (a == 2) {
>         console.log(' world');
>     } }`
> 
> Is there the possibility in future to implement that feature without the 
> keyword?
> What is the plan (read 'estimated date') for the rollout of this feature ?
> 
> The idea to develop in native way a good templating engine is exciting and 
> I'm looking forward for its complete implementation :)
> _______________________________________________
> es-discuss mailing list
> [email protected]
> https://mail.mozilla.org/listinfo/es-discuss

Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail

_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to