[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: [On-topic] Lua goes its own way [ Was: Off-topic received English rant
- From: Jonathan Goble <jcgoble3@...>
- Date: Tue, 15 Mar 2016 01:46:27 -0400
On Tue, Mar 15, 2016 at 1:34 AM, Dirk Laurie <dirk.laurie@gmail.com> wrote:
> 2016-03-14 23:00 GMT+02:00 Jonathan Goble <jcgoble3@gmail.com>:
>
>> Well, the primary intent of the match table was to provide a more
>> familiar interface for people more used to Python re matching
>
> Of all the motivations adduced for changing Lua, saying that
> Python/Ruby/Perl/Scheme/JSON/Julia/Go etc does it that way
> tends to be the one that impresses me least, even though I have
> been guilty of it myself (to my everlasting and well-archived shame).
I actually agree with that sentiment (that "this language does it that
way" is typically not impressing).
In this case, I also had a secondary intent, which was to support a
way to return extra match data, and ultimately, to support features
difficult or impossible with Lua's multiple-return-value style (such
as named captures, which I need to get back to working on). Once I
realized I was basically imitating Python's match object, I opted to
borrow some its semantics rather than reinvent the wheel from scratch.
So perhaps it's more appropriate to say that the latter (supporting
extra features) was the main reason for the concept of a match table,
but then once the decision was made to do it Python-style, that became
a secondary goal (providing a more familiar interface). In short, I
got the priorities backward (likely because I haven't done any work on
this library in a few weeks, combined with having a cold for the past
few days, so things are a little fuzzy right now).