Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upAdd support for arbitrary code inside template tags #279
Comments
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
michaelficarra
Jan 10, 2016
Member
Do-expressions will allow this:
`${ do if (a == 2) {
console.log('hi');
} }`|
Do-expressions will allow this: `${ do if (a == 2) {
console.log('hi');
} }` |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
manuel-di-iorio
Jan 10, 2016
Awesome! Can I ask why the do keyword ?
And something like the following will be supported?
`${ Hello do if (a == 2) {
console.log(' world');
} }`
//will output: Hello world
manuel-di-iorio
commented
Jan 10, 2016
|
Awesome! Can I ask why the
|
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
michaelficarra
Jan 10, 2016
Member
No, not at all. There's many things wrong with what you've written. "Hello " needs to be a literal part of the template, the completion value of the if statement is either null (the return value of console.log) or undefined, and in order to see the value produced by the template, it all needs to be within the argument list for console.log.
It seems you are very unfamiliar with JavaScript. I would recommend asking questions like this on Stack Overflow or some other medium. This issue tracker is meant for a different kind of discussion.
|
No, not at all. There's many things wrong with what you've written. It seems you are very unfamiliar with JavaScript. I would recommend asking questions like this on Stack Overflow or some other medium. This issue tracker is meant for a different kind of discussion. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
domenic
Jan 10, 2016
Member
Per https://github.com/tc39/ecma262/blob/master/CONTRIBUTING.md#feature-requests, closing this. @michaelficarra perhaps in the future redirect to StackOverflow sooner instead of indulging people :)
|
Per https://github.com/tc39/ecma262/blob/master/CONTRIBUTING.md#feature-requests, closing this. @michaelficarra perhaps in the future redirect to StackOverflow sooner instead of indulging people :) |
domenic
closed this
Jan 10, 2016
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
manuel-di-iorio
Jan 10, 2016
Sorry previously I made a typo.. I meant:
`Hello ${ do if (a == 2) {
console.log(' world');
} }`
@michaelficarra nope I already asked on SO and they redirected me here.. However the issue is now closed and I'm happy with the feature proposal. Hope to see its availability as soon as possible :)
manuel-di-iorio
commented
Jan 10, 2016
|
Sorry previously I made a typo.. I meant:
@michaelficarra nope I already asked on SO and they redirected me here.. However the issue is now closed and I'm happy with the feature proposal. Hope to see its availability as soon as possible :) |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
h4ckninja
commented
Jan 10, 2016
|
I'm not the micheal you are looking for. :) |
manuel-di-iorio commentedJan 10, 2016
Why not support any arbitrary code inside template strings expressions?
This is not supported i.e:
And with more complex code, like if, if-else, for loops, etc..
It would be nice to develop a template engine that uses this native approach instead of a string manipulation.