[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Pattern matching proposal: %B to match balanced string with specified escape
- From: Daurnimator <quae@...>
- Date: Wed, 13 Jan 2016 13:07:21 +1100
On 13 January 2016 at 11:54, Hisham <email@example.com> wrote:
> On 11 January 2016 at 19:42, Matthew Wild <firstname.lastname@example.org> wrote:
>> On 11 January 2016 at 21:06, Jonathan Goble <email@example.com> wrote:
>> I'm glad it is that way, or Lua would be Python. It doesn't mean your
>> patch isn't useful, or clever. Personally almost every time I use %b,
>> I wish it had a way to handle escaping.
> Further, I think I used things like [["[^"]*"]] many times in my code
> in situations where I should have used [[%B"\"]], had I had the
> option. This would make it easier to write more robust code.
>> But Lua simply isn't an all-features-included language.
> Given that the net increase of the code size is 5 lines, and the
> additional costs are two ints (memory) and one extra test in the loop
> (execution), I think this feature should be at least given
> consideration as something core-worthy. It is, after all, a clever,
> useful and tiny patch. On the other hand, I don't think I'd pull an
> extra dependency just to have %B (and I especially wouldn't if it
> monkey-patched string.match). But then, I wouldn't pull an extra
> dependency just to have string.rep() either, and that is in the core.
> Speaking of extra cost concerns, I'm afraid any benchmark on this
> would fall into the traps of microbenchmarks, but it would be nice to
> know if the difference is even measurable. Performance analysis is
> usually part of the process of proposing changes to Lua.
> -- Hisham
To add to the noise: +1.
I think this is a great simple improvement.
I hope roberto merges this :)