[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: A bug in string.gmatch and string.gsub?
- From: TNHarris <telliamed@...>
- Date: Tue, 30 Apr 2013 13:46:32 -0400
On Tuesday, April 30, 2013 02:32:58 AM Dirk Laurie wrote:
> I.e. in Perl, the way it is implemented in Lua is actually documented to be
> the way it is. One can't argue with that.
> But in Lua it is not so documented; it is no more part of Lua than the
> pre-5.2.2 treatment of out-of-range index values to table.reduce and
> table.insert was part of Lua. In Lua it is merely the way that strlib.c
> happens to implement it. One can argue with that.
Yes, I'm was pointing out that if you're going to apply the principle of least
surprise with respect to how regular expressions behave in other languages,
the majority opinion seems to be with Perl which Lua follows. I also checked
Node.JS and Ruby and they're the same.
On the other hand, Lua does not advertise regular expressions but just string
patterns. So breaking with tradition would not be unwarranted.