develooper Front page | perl.perl5.porters | Postings from October 2013

Re: Silent prototype mismatch

Thread Previous
From:
Peter Martini
Date:
October 9, 2013 18:39
Subject:
Re: Silent prototype mismatch
Message ID:
CAFyW6MR6JuQ-3Nw+Rjq2VEVVXLbjrnM7iVL8g3aqdD3Lf5Z7RQ@mail.gmail.com
On Wed, Oct 9, 2013 at 2:38 PM, Peter Martini <petercmartini@gmail.com> wrote:
> On Tue, Oct 8, 2013 at 9:13 PM, Eric Brine <ikegami@adaelis.com> wrote:
>>
>> Does the following make sense?
>>
>>>perl -wE"sub foo { bar('a','b'); } sub bar($$) { } foo(); say 'done'"
>> done
>>
>> Another way to look at it:
>>
>>>perl -wE"sub bar; sub bar($$) { } say 'done'"
>> done
>>
>>>perl -wE"sub bar($); sub bar($$) { } say 'done'"
>> Prototype mismatch: sub main::bar ($) vs ($$) at -e line 1.
>> done
>>
>
> Another example:
>
> perl -wE 'sub foo; foo("A", "B", "C"); sub foo($){ say @_;}'
>
> I

Forgot to turn off the touchpad on my laptop and managed to hit send
while typing :-/

I think this should warn.

Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About