Re: SpeciesConstructor(o, %Set) vs. %Set%

2018-12-13 Thread Kevin Gibbons
That is an excellent question; see https://github.com/tc39/ecma262/issues/1313 . I would lean towards using SpeciesConstructor because it is consistent with the language as currently defined, and we have not gotten consensus to decide on a different design. It's pretty unfortunate because it

Re: SpeciesConstructor(o, %Set) vs. %Set%

2018-12-13 Thread Jordan Harband
My sense is that any time you want to enable subclassing, you'd use SpeciesConstructor - are there specific cases where you're seeing it not be used? On Thu, Dec 13, 2018 at 12:06 PM Michał Wadas wrote: > Hi. > > This is question directed more to TC39 members. I'm updating Set methods >

SpeciesConstructor(o, %Set) vs. %Set%

2018-12-13 Thread Michał Wadas
Hi. This is question directed more to TC39 members. I'm updating Set methods proposal right now and I don't understand when SpeciesConstructor should be used and when I should just hardcode %Set%. Michał Wadas ___ es-discuss mailing list

Re: String identity template tag

2018-12-13 Thread Mark Miller
I think this is the right question. I agree that String.cook or whatever it is called with typically be called explicitly rather than used syntactically as a tag. However, putting the optional mapping function aside for a moment, if the job it is doing is equivalent to that done by a tag function,

Re: String identity template tag

2018-12-13 Thread Allen Wirfs-Brock
> On Dec 13, 2018, at 10:37 AM, T.J. Crowder > wrote: > > Fair enough, but the primary use of this function is *not* using it as a tag > function, but rather as a normal function. It doesn't make sense to use it as > a tag function, the result is the same as an untagged template. The only

Re: String identity template tag

2018-12-13 Thread T.J. Crowder
On Thu, Dec 13, 2018 at 6:37 PM T.J. Crowder wrote: > > But called normally, it's a useful helper, for instance in > Isiah's `escape`... Going through the process of the example for my message just now made me think more about this function. Suppose it: 1. Accepted an array of substitutions

Re: String identity template tag

2018-12-13 Thread T.J. Crowder
On Thu, Dec 13, 2018 at 5:56 PM Mark Miller wrote: > > I like String.cooked best. While I agree that method names should > generally be verbs, I suggest this rule should *not* be used for > template literal tag names. Fair enough, but the primary use of this function is *not* using it as a tag

Re: String identity template tag

2018-12-13 Thread Mark Miller
I like String.cooked best. While I agree that method names should generally be verbs, I suggest this rule should *not* be used for template literal tag names. Rather, the tag name should generally be descriptive, naming the language being parsed or the way it is interpreted or what the value of

Re: String identity template tag

2018-12-13 Thread T.J. Crowder
On Thu, Dec 13, 2018 at 1:03 PM kai zhu wrote: > why not copy python's list-zip static-function The result isn't a string, it's an array you'd then have to join with `.join("")`. Not that `zip` isn't a useful function *too*... (At least, presumably it is, it shows up in libs a lot. I don't

Re: String identity template tag

2018-12-13 Thread kai zhu
why not copy python's list-zip static-function ( https://www.programiz.com/python-programming/methods/built-in/zip)? i'm also against the spread-operator signature. ```javascript // python-inspired list-zip static-function // List.zip(list1, list2) str = List.zip( templateList, argList

Re: String identity template tag

2018-12-13 Thread Andrea Giammarchi
FWIW, I've used same logic for something like a no-op for i18n`strings` [1] so, considering it has easily use cases with mapped interpolations too, I think it's more than natural to have that in core. It's also backward compatible/polyfillable so this is kinda a no-brainer, name a part, of

Re: String identity template tag

2018-12-13 Thread T.J. Crowder
In general, I think method names should be verbs in the imperative tense (okay, *mood* if you like linguistic distinctions), which would argue for `cook` rather than `cooked`. (`String.raw` is an unfortunate exception to this rule, which has largely been used throughout the standard library.

Re: String identity template tag

2018-12-13 Thread Isiah Meadows
I like `String.cooked`, especially considering `String.raw` already basically does this, just using `template.raw` instead of `template`. - Isiah Meadows cont...@isiahmeadows.com www.isiahmeadows.com On Thu, Dec 13, 2018 at 3:23 AM Claude Pache wrote: > > Random suggestions: > > *

Re: String identity template tag

2018-12-13 Thread Isiah Meadows
To me, `String.tag` seems more descriptive of the syntactic location (the template *tag*) than the semantics it carries. - Isiah Meadows cont...@isiahmeadows.com www.isiahmeadows.com On Thu, Dec 13, 2018 at 2:53 AM Andrea Giammarchi wrote: > > I agree with Mark, and I wonder why

Re: String identity template tag

2018-12-13 Thread Claude Pache
Random suggestions: * `String.cooked`, which pairs well with already existing `String.raw` * `String.vanilla` * `String.plain` * `null`, i.e., using a null (or undefined) value as tag before a template literal is equivalent to using no tag. (Con: not polyfillable) —Claude