> On 14 Sep 2015, at 1:38 AM, Alexander Jones <[email protected]> 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 different to > > ```js > let template = ({foo, bar}) => `this ${foo} and that ${bar}`; > // later... > let output = template({foo: "thing", bar: "other thing"}); > ``` > > then I have a couple of answers off the top of my head: > * The value of `template` is a simple string and thus can be trivially > loaded from JSON or a file in the former case, but not the latter. Getting > the latter involves some kind of eval anyway.
Exactly - being able to not touch modules for something like this is important. > * The number of occurrences of each template parameter (e.g. `"foo"`) is > limited to once at the definition site, and once at the invocation site, > instead of twice at definition. `with` seems like a non-starter. Minimising definitions is worth doing. Although, the good thing about arguments is that it's possible to specify default values... _______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

