Re: RegExp.escape()

2015-06-13 Thread Allen Wirfs-Brock
On Jun 13, 2015, at 1:18 PM, C. Scott Ananian wrote: To throw some more paint on the bikeshed: The instanceof RegExp and RegExp(...) parts of the perfect implementation of `RegExp.tag` should also be fixed to play nicely with species. I think Allen and I would say that you should

Re: Language design

2015-06-13 Thread joe
Heh, I remember I thought many ES6 features were oddly designed, or even crazy. However, since I was dealing with production code and needed said features (and had decided to target ES6), I dutifully added 'em to my crappy transpiler one-by-one. Now I think *I* was crazy. When I was

Re: RegExp.escape()

2015-06-13 Thread Allen Wirfs-Brock
On Jun 13, 2015, at 4:16 PM, Allen Wirfs-Brock wrote: On Jun 13, 2015, at 1:18 PM, C. Scott Ananian wrote: To throw some more paint on the bikeshed: The instanceof RegExp and RegExp(...) parts of the perfect implementation of `RegExp.tag` should also be fixed to play nicely with

Re: RegExp.escape()

2015-06-13 Thread Mark S. Miller
Perfection? function re(first, ...args) { let flags = first; function tag(template, ...subs) { const parts = []; const numSubs = subs.length; for (let i = 0; i numSubs; i++) { parts.push(template.raw[i]); const subst = subs[i] instanceof RegExp ?

Re: RegExp.escape()

2015-06-13 Thread Mark S. Miller
The point of this last variant is that data gets escaped but RegExp objects do not -- allowing you to compose RegExps: re`${re1}|${re2}*|${data}` But this requires one more adjustment: function re(first, ...args) { let flags = first; function tag(template, ...subs) { const

Re: RegExp.escape()

2015-06-13 Thread C. Scott Ananian
On Sat, Jun 13, 2015 at 1:51 AM, Mark S. Miller erig...@google.com wrote: Nice! Inspired // Based on // https://github.com/benjamingr/RexExp.escape/blob/master/polyfill.js function re(template, ...subs) { const parts = []; const numSubs = subs.length; for (let i = 0; i

Re: RegExp.escape()

2015-06-13 Thread Mark S. Miller
Good idea bug infinite recursion bug. Fixed: function re(first, ...args) { let flags = first; function tag(template, ...subs) { const parts = []; const numSubs = subs.length; for (let i = 0; i numSubs; i++) { parts.push(template.raw[i]);

RE: RegExp.escape()

2015-06-13 Thread Domenic Denicola
All of these should be building on top of RegExp.escape :P From: es-discuss [mailto:es-discuss-boun...@mozilla.org] On Behalf Of Mark S. Miller Sent: Saturday, June 13, 2015 02:39 To: C. Scott Ananian Cc: Benjamin Gruenbaum; es-discuss Subject: Re: RegExp.escape() The point of this last variant

Re: RegExp.escape()

2015-06-13 Thread Mark Miller
Perhaps. I encourage you to draft a possible concrete proposal. On Sat, Jun 13, 2015 at 11:30 AM, Jordan Harband ljh...@gmail.com wrote: Would it help subclassing to have the list of syntax characters/code points be on a well-known-symbol property? Like `RegExp.prototype[@@syntaxCharacters]

Re: RegExp.escape()

2015-06-13 Thread C. Scott Ananian
To throw some more paint on the bikeshed: The instanceof RegExp and RegExp(...) parts of the perfect implementation of `RegExp.tag` should also be fixed to play nicely with species. I think Allen and I would say that you should *not* use the species pattern for instantiating the new regexp

Re: RegExp.escape()

2015-06-13 Thread Benjamin Gruenbaum
On Sat, Jun 13, 2015 at 9:07 PM, Mark S. Miller erig...@google.com wrote: On Sat, Jun 13, 2015 at 9:17 AM, Domenic Denicola d...@domenic.me wrote: All of these should be building on top of RegExp.escape :P It's funny how, by considering it as leading to a proposal, I quickly saw deep

Re: RegExp.escape()

2015-06-13 Thread Mark S. Miller
On Sat, Jun 13, 2015 at 11:39 AM, Benjamin Gruenbaum benjami...@gmail.com wrote: On Sat, Jun 13, 2015 at 9:07 PM, Mark S. Miller erig...@google.com wrote: On Sat, Jun 13, 2015 at 9:17 AM, Domenic Denicola d...@domenic.me wrote: All of these should be building on top of RegExp.escape :P

Re: RegExp.escape()

2015-06-13 Thread Benjamin Gruenbaum
What about that part in particular? That said - I'm very open to allowing implementations to escape _more_ than `SyntaxCharacter` in their implementations and to even recommend that they do so in such a way that is consistent with their regular expressions. What do you think about doing that?

Re: RegExp.escape()

2015-06-13 Thread Mark S. Miller
On Sat, Jun 13, 2015 at 9:17 AM, Domenic Denicola d...@domenic.me wrote: All of these should be building on top of RegExp.escape :P I am not yet agreeing or disagreeing with this. Were both to become std, clearly they should be consistent with each other. At the time I wrote this, it had not

Re: RegExp.escape()

2015-06-13 Thread Jordan Harband
Would it help subclassing to have the list of syntax characters/code points be on a well-known-symbol property? Like `RegExp.prototype[@@syntaxCharacters] = Object.freeze('^$\\.*+?()[]{}|'.split(''));` or something? Then @exec could reference that, and similarly `RegExp.escape` and

Re: Language design

2015-06-13 Thread KOLANICH
I have tested Boris's build The results are: chrome is broken in large part Mail.ru mail interface is broken Gmail is broken google docs is broken peacekeeper is not broken 3 russian it news portals are not broken (UI is OK, on the one sending the comment worked with minor bug in UI, but when I