[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Inconsistency with the manual
- From: Dirk Laurie <dirk.laurie@...>
- Date: Wed, 11 Oct 2017 12:41:23 +0200
2017-10-11 12:06 GMT+02:00 Soni L. <firstname.lastname@example.org>:
> On 2017-10-11 05:27 AM, Dirk Laurie wrote:
>> 2017-10-11 4:51 GMT+02:00 Soni L. <email@example.com>:
>>> It's one of:
>>> - caret is wrong
>>> - frontier is wrong
>>> - manual is wrong
>> A fourth possibility: behaviour of a bare "^" is undefined.
>> Lua is replete with silentlly undefined and implementation-dependent
>> behaviour. It is impossible for manual writers to anticipate to what
>> lengths fractious but resourceful users might go.
> I'd still like for %f to match at the start of a match. Is there a good
> reason why it doesn't?
Specifying a starting position means that one is not interested in frontiers
before a certain point, not that a non-frontier should be treated as a frontier.
It is easy to get that behaviour if you want it: just code str:sub(n):match(pat)
instead of str:match(pat,n). Whereas if that behaviour were the default,
there would be no easy way of not getting it if you don't want it.