A use I thought up (although I got lazy and abandoned it later) was an
`exec` template tag, for executing commands. Or, and this just came off the
to of my head, you could use it as a vdom library as almost like a Lisp
reader macro:
```js
n`.form-ctrl`(
n`input#input`("input"),
> modulo the obvious mistake
Oops. x]
> you could use it as a vdom library as almost like a Lisp reader macro:
That would be interesting. There's still lots of runtime processing
though. Maybe a build-time tool can also optimize it though, but if it
happens to be executed at runtime it'll just
Problem is: your idea has already been tried and found to be pretty slow.
React devs did briefly consider this, but found that it had fundamental
speed limitations. And precompilation is already happening with existing
templates, even though building them normally is still cheap to do.
That link details other reasons, such as tooling.
On Wed, Jan 13, 2016, 18:11 Isiah Meadows wrote:
> Problem is: your idea has already been tried and found to be pretty slow.
> React devs did briefly consider this, but found that it had fundamental
> speed limitations.
Interesting!
On Wed, Jan 13, 2016 at 3:12 PM, Isiah Meadows wrote:
> That link details other reasons, such as tooling.
>
>
> On Wed, Jan 13, 2016, 18:11 Isiah Meadows wrote:
>>
>> Problem is: your idea has already been tried and found to be pretty
The two code samples you posted are equivalent (modulo the obvious
mistake). AFAIU there is still only a single parsing pass for template
strings.
On Tuesday, 12 January 2016, /#!/JoePea wrote:
> The thing with template strings is that they are used at runtime. This
> could be
The thing with template strings is that they are used at runtime. This
could be slow if we're compiling things at runtime all the time,
whereas a server-side templating solution might lead JavaScript
functions compiled from templates (like in the case with Meteor Blaze
Spacebars or React JSX),
> The idea to develop in native way a good templating engine is exciting
and I'm looking forward for its complete implementation :)
This topic arose in an earlier thread that I'm too lazy to track down. Some
insane person from Microsoft? actually showed us how to write ifs and
everything using
> Watch your precedence, Caitlin. You'll need to wrap that arrow in parentheses
> like so:
Yes, I guess arrow functions aren’t a PrimaryExpression — doesn’t really
matter, though
> On Jan 10, 2016, at 11:58 PM, Michael Ficarra
> wrote:
>
> Watch your precedence,
Yes Bob, after a personal testing with a complete template engine using the
ES6 template strings, I realized that their use (in mine use case, of
course) is slowest than the approach that I'm using right now (like the
Underscore template). Thanks everyone :)
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
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
Watch your precedence, Caitlin. You'll need to wrap that arrow in
parentheses like so:
```js
`Hello ${(_ => {
if (a == 2) {
console.log(‘world’);
}
})()}`;
```
Michael
On Sun, Jan 10, 2016 at 7:12 PM, Caitlin Potter
wrote:
> Do-Expressions are still floating
Thanks Caitlin for the workaround ;)
However, as you can note, to write the following is not that much
praticabile and readable:
${()=>{
//code here
}()}
At least, the *do *keyword will improve the situation with i.e:
${do {
//code here
}}
PS: Is w/ or w/o the
If it's any consolation, you can currently use Babel (f.e with
Webpack, Browserify, etc) to compile do-expressions
(babeljs.io/docs/plugins/syntax-do-expressions), so you can use the
syntax right now.
On Sun, Jan 10, 2016 at 11:07 PM, Manuel Di Iorio wrote:
> Thanks Caitlin for
15 matches
Mail list logo