Re: Proposal for exact matching and matching at a position in RegExp

2010-03-04 Thread Andy Chu
> Regarding "RegEx", I'm pretty certain Brendan was talking about a > hypothetical new library (name unimportant) that the JavaScript community > might create in the future. I don't think anyone has suggested adding a I worked on something like this: http://code.google.com/p/json-pattern/ . It is

Re: Proposal for exact matching and matching at a position in RegExp

2010-03-02 Thread Andy Chu
> Heh. :-) I've posted half of a response at > http://blog.stevenlevithan.com/archives/fixing-javascript-regexp , and > within the next couple weeks I'll try to follow up on es-discuss with a > write-up that excludes the less realistic change proposals from that page > and adds suggested new featur

Re: Proposal for exact matching and matching at a position in RegExp

2010-03-02 Thread Andy Chu
> If we agree on /y, is the remainder of your proposal to simply add a pos > (and possibly endPos) argument to the exec and test methods? I'd be all for > that if the lastIndex property was also deprecated. I've argued for the same > thing at http://blog.stevenlevithan.com/archives/fixing-javascrip

Re: Proposal for exact matching and matching at a position in RegExp

2010-02-22 Thread Andy Chu
> Not clear, since ES3 deviated from Perl and will not reconverge. The > committee is not going to standardize any lastIndex or pos mapping per > target string and regex pair, I am pretty sure. I'm glad we're not following Perl to Perl 5 regexps. Not clear on the "pos per pair" statement. All th

Re: Proposal for exact matching and matching at a position in RegExp

2010-02-22 Thread Andy Chu
(belated followup) > I think a lot of people (myself included) use a similar mental model, > although it doesn't quite match the implementation details. But even > according to this model, avoiding /y wouldn't keep ES regex flags pure as > mere pattern attributes since ES already crossed that brid

Re: Proposal for exact matching and matching at a position in RegExp

2010-02-12 Thread Andy Chu
> \G is more flexible and it is rather similar to ^ conceptually. > > The mental model happens to be out of sync with how regexps are > implemented.  The implicit .*? at the start of a regexp is actually > the fastest way to implement since you are using the fast internal > search mechanisms that t

Re: Proposal for exact matching and matching at a position in RegExp

2010-02-12 Thread Andy Chu
> One thing I didn't bring up is that Python actually has an "endpos" > argument.  You do regex.search(s, 10, 20), and it will stop at > position 20.  I couldn't think of a real use case for this.  But > anyone can think of one, that might be a consideration and sway things > in favor of separate m

Re: Proposal for exact matching and matching at a position in RegExp

2010-02-12 Thread Andy Chu
gt;/gc) { >       ... >   } elsif ($html =~ /\G&#?\w+;/gc) { >       ... >   } > } > > Sorry for the tangent, but I thought it might be helpful to describe how \G > is used elsewhere. > > Steven Levithan > http://blog.stevenlevithan.com > > --

Re: Proposal for exact matching and matching at a position in RegExp

2010-02-09 Thread Andy Chu
On Tue, Feb 9, 2010 at 7:34 AM, Kam Kasravi wrote: > Hi Andy > I had mentioned to Brendan at the last TC39 that you had ported narcissus > and had observed the cost of match. > There is a new global regexp parameter called 'y' which prevents the copy > from occurring. > I've taken a look at narcis

Re: Proposal for exact matching and matching at a position in RegExp

2010-02-09 Thread Andy Chu
> However, expanding the language by adding extra parameters to existing > functions is annoying because it means you can't test for the presence > of absence of the feature with a simple if: > > if (RegExp.funkyNewFunction) { > ... > } That's true, I would want to be able to test for the feature

Re: Proposal for exact matching and matching at a position in RegExp

2010-02-08 Thread Andy Chu
On Wed, Jan 27, 2010 at 10:03 PM, Andy Chu wrote: > (The original message was held up in spam moderation for awhile) > > Here is an addendum, after it was pointed out to me that this issue > has come up before: > > http://andychu.net/ecmascript/RegExp-Enhancements-2.html

Re: simple modules

2010-01-30 Thread Andy Chu
On Fri, Jan 29, 2010 at 5:13 PM, David Herman wrote: > We had a good discussion about modules at this week's meeting, and Sam > Tobin-Hochstadt and I have worked out a strawman for a simple module system. > I've posted a first draft to the wiki: > >    http://wiki.ecmascript.org/doku.php?id=stra

Re: Proposal for exact matching and matching at a position in RegExp

2010-01-27 Thread Andy Chu
(The original message was held up in spam moderation for awhile) Here is an addendum, after it was pointed out to me that this issue has come up before: http://andychu.net/ecmascript/RegExp-Enhancements-2.html Basically the proposal is to add parameters which can override the internal state of t

Proposal for exact matching and matching at a position in RegExp

2010-01-27 Thread Andy Chu
Here is a very simple proposal. If I can get access to the wiki I could copy it in, but for now it's here: http://andychu.net/ecmascript/RegExp-Enhancements.html Comments appreciated. thanks, Andy ___ es-discuss mailing list es-discuss@mozilla.org htt

Re: Packages proposal questions

2010-01-23 Thread Andy Chu
On Tue, Jan 19, 2010 at 8:28 AM, wrote: > Hi folks, > > I get the feeling people are not really seeing the link between the > module proposals and the package proposal: > >  http://wiki.ecmascript.org/doku.php?id=strawman:modules_packages > > If my perception is correct, then could you folks plea

Re: Module system strawpersons

2010-01-18 Thread Andy Chu
On Mon, Jan 18, 2010 at 2:24 PM, Kam Kasravi wrote: > Hi Mike > > The former but not in the way you've described. Rather > > module A: > this.getB= function() { >   return new (import 'B')(); > } > > module B: > this.getA = function() { >   return new (import 'A')(); > } In CommonJS, this doesn't

Re: Module system strawpersons

2010-01-18 Thread Andy Chu
On Mon, Jan 18, 2010 at 10:29 AM, Kam Kasravi wrote: > Yes, that looks right, I also remember a reference to the 'dot' notation > where namespace > access would be arbitrated implicitly by objects representing the '.' It may > have been in > one of Lars Hansen papers on gradual typing. In any case

Re: Module system strawpersons

2010-01-16 Thread Andy Chu
On Thu, Jan 14, 2010 at 1:58 PM, wrote: > Hi Mike, > > On Thu, Jan 14, 2010 at 1:29 PM, Mike Samuel wrote: >> Are these proposals mutually exclusive or complementary. >> If (1) and (2) are exclusive, is there a place to collect use cases >> for a module-off? > > For my part, I think (1) and (2)

Re: Prematurely announcing ES-Lab (was: quasi-literal strawman)

2009-12-26 Thread Andy Chu
> Funny you should mention that. At ES-Lab > , Tom Van Cutsem and I have been defining a > JsonML-based representation of ES5 ASTs. Now seems as good a time as any to > announce it. See . A > playground for

Re: quasi-literal strawman

2009-12-18 Thread Andy Chu
>> So then my question is why it needs to specify a desugaring.  Why is a >> quasi-literal not a string? > > I still don't understand the question? > > Why `foo$bar` and not "foo$bar"?  Well, the latter doesn't do anything > useful with the expression (bar). OK, so to back up a bit, the point of q

Re: quasi-literal strawman

2009-12-17 Thread Andy Chu
> That a lot of formatting can be done in-library is a great point. > > Hopefully, by providing a desugaring that can easily be back-ported to > older code by things like rewriting minifiers, and implementing most > of the feature in library code that will run on older versions of JS; > we can allo

quasi-literal strawman

2009-12-16 Thread Andy Chu
>> If you haven't yet read http://www.python.org/dev/peps/pep-3101/ (Advanced >> String Formatting) I suggest you do - its well worth a read and feels like a >> possible very javascripty solution. > > I have not read it.  Thanks for the link.  It has a good summary of > alternate syntaxes and est

Re: Alternative to Mozilla's eval in a scope

2009-12-13 Thread Andy Chu
On Sun, Dec 13, 2009 at 10:23 PM, wrote: > On Sun, Dec 13, 2009 at 10:17 PM, Andy Chu wrote: >> If Caja has already done something along these lines then awesome -- >> I'm just asking if there is discussion about standardizing such a >> thing. > > Kris Kowal co

Re: Alternative to Mozilla's eval in a scope

2009-12-13 Thread Andy Chu
On Sun, Dec 13, 2009 at 9:56 PM, wrote: > Hi Andy, > > On Sun, Dec 13, 2009 at 9:49 PM, Andy Chu wrote: >> There is a function called "loadCode" for now, that behaves a little >> bit like eval: >> >> var code = loadCode("var foo=3; v

Alternative to Mozilla's eval in a scope

2009-12-13 Thread Andy Chu
I'm writing a JavaScript program ("server-side") that loads plugins written in JS. I would like to prevent the plugins from messing with my program, and from Googling around I found this: http://ejohn.org/blog/eval-kerfuffle/ So basically Firefox briefly had a second "scope" argument to eval, un