[tpm] Riddle me this ...

James E Keenan jkeen at verizon.net
Sat Dec 29 08:41:23 PST 2012


On 12/28/12 11:36 PM, Uri Guttman wrote:
> On 12/28/2012 11:28 PM, Fulko Hew wrote:
>> On Fri, Dec 28, 2012 at 10:57 PM, James E Keenan <jkeen at verizon.net>
>> wrote:
>>
>>> On 12/27/12 11:43 PM, Uri Guttman wrote:
>>>
>>> i want to clarify my statement there. it is the scalar prototype of not
>>>> that is causing this as well as its low precedence.
>>>>
>>>
>>> I'm familiar with prototypes as an aspect of subroutines in Perl (for
>>> instance, Test::More::is is, under the hood, prototyped $$;$), but
>>> not with
>>> the concept of prototypes for operators. Can you point me toward the
>>> documentation or source code for that?
>>>
>>
>>
>> Don't think about prototypes, its seems you are encountering a precedence
>> issue.
>
> it is a combination of the prototype and precedence as i showed. without
> the $ prototype of 'not', it wouldn't force the , to be in scalar mode
> and have it return the test name as the arg to not. that is why the name
> wasn't ever printed in all of jim's cases.
>
> the precedence comes into play as it allows the , to be evaluated first
> before 'not'. ! would bind tightly to the first value and let , be a
> list op (context provided by the ok() call).
>
> this only happens because both the low precedence of 'not' and its
> scalar prototype work to make , into a scalar op with 2 args.
>

Thanks to all.

Based on feedback on this list and from a similar post on the St Louis 
Perlmongers list, I've created two patches for t/op/not.t in the Perl 5 
core distro and sent them to perlbug:

https://rt.perl.org/rt3/Ticket/Display.html?id=116242

We should probably continue the discussion there.

Thank you very much.
Jim Keenan


More information about the toronto-pm mailing list