Sent with the wrong subject...
On Tue, Sep 15, 2015 at 7:03 PM, Isiah Meadows wrote:
> I think you forgot to change the subject/strip other content/etc. ;)
>
> Plus, I learned the hard way myself that it's easier to have my
> subscription set to forward everything. It's not a particularly high
>
I don't think there's any risk in using my initial gist based on `Function`
and `with` ... really. You should **never** pass within `${parts}` user
inputs, you just pas there a variable name, or you reach a property.
```js
var str = 'my ${gist}';
str.template({gist: 'window.alert(123)'});
// my wi
> On 16 Sep 2015, at 12:39 AM, Claude Pache wrote:
>
> That doesn't make much sense, because regexpes are first-class objects, while
> template literals are syntax.
>
> The nearest equivalent of the string-to-regexp feature is the string-to-code
> conversion facility provided by `eval` and `Fu
This seems to be the same thing I posted before as [String.substitute()](
https://esdiscuss.org/topic/string-substitute) I guess I didn't explain
correctly, but ayy I'm glad you guys are discussing this.
On Tue, Sep 15, 2015 at 10:39 AM, Claude Pache
wrote:
>
> Le 15 sept. 2015 à 14:02, Herby Vo
> Le 15 sept. 2015 à 14:02, Herby Vojčík a écrit :
>
>
>
> Andrea Giammarchi wrote:
>> Yet it doesn't play well with i18n since arguments passed to the IIFE
>> would still come from the current local scope. RegExp would play nicer
>
> Oh, I meant it other way, my dense communication again pro
From: Isiah Meadows
<mailto:isiahmead...@gmail.com>
Sent: 9/13/2015 4:15 PM
To: Mark S. Miller <mailto:erig...@google.com>
gt;>> really offer much of an advantage over a function as far as templating
>>>>>> goes
>>>>>> (IMHO).
>>>>>>
>>>>>> Thomas
>>>>>>
>>>>>> On 14 Sep 2015, at 11:04 AM, Ron B
> >>>>>>>
> > >>>>>>> Ron: Yes, that's already possible - but tagged template
> > strings don't really offer much of an advantage over a function as
> far
> > as templating goes (IMHO).
> > >>>>>>
goes (IMHO).
> >>>>>>>
> >>>>>>> Thomas
> >>>>>>>
> >>>>>>> On 14 Sep 2015, at 11:04 AM, Ron Buckton
> wrote:
> >>>>>>>
> >>>>>>>> This is theoret
Bob, not sure why you think template means HTML, in my case the main
problem I have in JS is the absence of basic `printf` like syntax so that I
can build at runtime any kind of i18n string passing an object, without
needing to have the string evaluated in place, which is the strength of ES6
templa
May be getting off-topic here, but I wonder why we need templating
languages at all in this day and age. Originally templating systems were
developed for server-centric applications such as PHP etc. which generate
HTML and blast it down to the client, as a way to untangle program logic
and display
t;>>>>>> Thomas
>>>>>>>
>>>>>>> On 14 Sep 2015, at 11:04 AM, Ron Buckton
>>>>>>> wrote:
>>>>>>>
>>>>>>>> This is theoretically possible:
>>>>>>>>
>>>
;>>>
>>>> ```
>>>> let t = $template`
>>>> ${$item.permalink}
>>>> ${$each($item.comments)`
>>>> ${$parent.permalink}
>>>> ${$if($item.title)`
>>>> ${$parent.permalink}
>>>>
t;>>>>> ```
>>>>>> let t = $template`
>>>>>> ${$item.permalink}
>>>>>> ${$each($item.comments)`
>>>>>> ${$parent.permalink}
>>>>>> ${$if($item.title)`
>>>>>> ${$
.permalink}
>>> `}
>>> `}
>>> `;
>>> let s = t(data);
>>> ```
>>>
>>> ...given an adequate implementation using proxies (to create bindings
>>> for e.g. `$item.permalink` for later evaluation) and tagged template
>>>
;>> ${$parent.permalink}
>>>> ${$if($item.title)`
>>>> ${$parent.permalink}
>>>> `}
>>>> `}
>>>> `;
>>>> let s = t(data);
>>>> ```
>>>>
>>>> ...given an adequa
hether or not this would make for
>>> a reasonable implementation is left to the reader.
>>>
>>> Ron
>>>
>>>
>>> From
sonable implementation is left to the reader.
Ron
From: Isiah Meadows <mailto:isiahmead...@gmail.com>
Sent: 9/13/2015 4:15 PM
To: Mark S. Miller <mailto:erig...@google.com>
Cc: Bob Myers <mailto:r...@gol.com>; es-discuss
or not this would make for a reasonable implementation is left to
>> the reader.
>>
>> Ron
>> --
>> From: Isiah Meadows
>> Sent: 9/13/2015 4:15 PM
>> To: Mark S. Miller
>> Cc: Bob Myers ; es-discuss
>> Subject:
m.permalink` for later evaluation) and tagged template functions.
> Whether or not this would make for a reasonable implementation is left to
> the reader.
>
> Ron
> --
> From: Isiah Meadows
> Sent: 9/13/2015 4:15 PM
> To: Mark S. Miller
>
eft to the
> reader.
>
> Ron
> From: Isiah Meadows
> Sent: 9/13/2015 4:15 PM
> To: Mark S. Miller
> Cc: Bob Myers; es-discuss
> Subject: Re: Template strings as a template language.
>
> On Sun, Sep 13, 2015 at 7:09 PM, Mark S. Miller wrote:
> >
> >
>
Miller<mailto:erig...@google.com>
Cc: Bob Myers<mailto:r...@gol.com>; es-discuss<mailto:es-discuss@mozilla.org>
Subject: Re: Template strings as a template language.
On Sun, Sep 13, 2015 at 7:09 PM, Mark S. Miller wrote:
>
>
> On Sun, Sep 13, 2015 at 8:58 AM, Bob Myers
On Sun, Sep 13, 2015 at 7:09 PM, Mark S. Miller wrote:
>
>
> On Sun, Sep 13, 2015 at 8:58 AM, Bob Myers wrote:
>>
>> Templating languages typically "compile" templates into functions through
>> various lexical transformations.
>>
>> Consider a template file foo.tem:
>>
>> ```
>> My name is ${this
On Sun, Sep 13, 2015 at 8:58 AM, Bob Myers wrote:
> Templating languages typically "compile" templates into functions through
> various lexical transformations.
>
> Consider a template file foo.tem:
>
> ```
> My name is ${this.name}.
> ```
>
> Lexically transform this into
>
> ```
> function foo(
Templating languages typically "compile" templates into functions through
various lexical transformations.
Consider a template file foo.tem:
```
My name is ${this.name}.
```
Lexically transform this into
```
function foo() {
return `My name is ${this.name|}.`;
}
Then invoke the template as e
> On 14 Sep 2015, at 1:38 AM, Alexander Jones wrote:
>
> Not exactly sure what you mean. But if you are you asking how
>
> ```js
> let template = 'this ${foo} and that ${bar}';
> // later...
> let output = String.evalTemplate(template, {foo: "thing", bar: "other
> thing"});
> ```
> is differe
Not exactly sure what you mean. But if you are you asking how
```js
let template = 'this ${foo} and that ${bar}';
// later...
let output = String.evalTemplate(template, {foo: "thing", bar: "other
thing"});
```
is different to
```js
let template = ({foo, bar}) => `this ${foo} and that ${bar}`;
//
Mark,
I'll put together a GitHub gist or repo and send it to you in the morning (I
should be asleep) to make things clearer.
I'll try explaining it differently in the meantime:
What I'd like to do is use ES6 Template string as a templating language. For
the sake of readability and maintainabili
The great achievement of modern js module systems including the es6 std
module system is to end the greatest pain of prior js: linkage through side
effects to the shared global scope. Good riddance.
If you're talking about a scope other than the global one, how would a
template come to be evaluate
How is explicitly passing a scope different from calling the function with a
{title, content}
object?
On Sun, Sep 13, 2015 at 7:24 AM, Alexander Jones wrote:
> Same place as `eval`. Arguably both should have the option of explicitly
> passing a scope, for extra strictness, like Python's.
They would be whatever they are in the scope in which the template string is
evaluated.
Thomas
> On 14 Sep 2015, at 12:15 AM, Mark S. Miller wrote:
>
>
>
>> On Sun, Sep 13, 2015 at 7:08 AM, Thomas
>> wrote:
>> What I've been doing:
>>
>> export const template = ({title, content}) => `tem
Same place as `eval`. Arguably both should have the option of explicitly
passing a scope, for extra strictness, like Python's.
On 13 September 2015 at 15:15, Mark S. Miller wrote:
>
>
> On Sun, Sep 13, 2015 at 7:08 AM, Thomas
> wrote:
>
>> What I've been doing:
>>
>> export const template = ({t
On Sun, Sep 13, 2015 at 7:08 AM, Thomas
wrote:
> What I've been doing:
>
> export const template = ({title, content}) => `template string for
> ${title}`;
>
> Or variations thereof. I then import that module wherever I need to use
> the template and call it as a function.
>
If you were not to ca
What I've been doing:
export const template = ({title, content}) => `template string for ${title}`;
Or variations thereof. I then import that module wherever I need to use the
template and call it as a function.
Using eval and having the template string as a normal string (so, read the
templat
I think it would look something like this:
```js
tag `string text ${expression} string text`
// vs.
String.templateEval("string text ${expression} string text", tag)
```
(Clearly, evaluation errors would be a runtime error, much like how `eval`
itself works.)
My hunch is this would be quite a us
On Sun, Sep 13, 2015 at 2:42 AM, Thomas
wrote:
> I'd really like to use Template strings as a templating language, but
> unless I include a lot of boilerplate code (export a template string
> wrapped in a function from a file)
Hi Thomas, could you give a concrete example of the boilerplate you
36 matches
Mail list logo