[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Comprehending string.gsub
- From: Alexander Gladysh <agladysh@...>
- Date: Fri, 13 Apr 2012 20:16:56 +0400
On Fri, Apr 13, 2012 at 20:02, Roberto Ierusalimschy
<roberto@inf.puc-rio.br> wrote:
>> > Yes, but %0 is only available for string replacements. %1 is
>> > synthesized to be the entire match for all types of replacements, as
>> > this is convenient for all non-string replacements.
>>
>> I don't doubt you but I can't read that out of what it says in the manual:
>
> If you want to understand what is going on, Peter gave a good explanation.
>
> If you want to be picky, the manual does not say that it is an error for
> 'gsub' to access a non-existent capture.
>
> There is a myriad of cases that the manual does not explain
> what will happen. For all of them, assume a clause: "If
> <something-not-explained-before-or-after> happens, the behavior is
> undefined".
Unspecified? Implementation-specific? Undefined sounds scary to me. :-)
Alexander.