Skip Menu |
Report information
Id: 114634
Status: open
Priority: 0/
Queue: perl6

Owner: Nobody
Requestors: moritz <moritz.lenz+perl [at] gmail.com>
Cc:
AdminCc:

Severity: (no value)
Tag: Bug
Platform: (no value)
Patch Status: (no value)
VM: (no value)



Subject: over-eager multi dispatcher optimization
Date: Tue, 28 Aug 2012 08:42:43 +0200
To: rakudobug [...] perl.org
From: Moritz Lenz <moritz [...] faui2k3.org>
Download (untitled) / with headers
text/plain 571b
"Just because it's an A doesn't mean it can't be a B" Consider { my class A {}; my class B { }; my class C is B is A {}; multi f(A) { "A" }; multi f(B) { "B" }; sub g(A $x) { say f($x) }; # type A g(C.new); } # prints A { my class A {}; my class B { }; my class C is B is A {}; multi f(A) { "A" }; multi f(B) { "B" }; sub g(A $x) { say f($x) }; # type A g(C.new); } # prints B and with the optimizer turned off, both print Ambiguous call to 'f'; these signatures all match: :(A ) :(B ) Found by sorear++
CC: bugs-bitbucket [...] rt.perl.org
Subject: Re: [perl #114634] over-eager multi dispatcher optimization
Date: Tue, 28 Aug 2012 09:15:41 -0400
To: perl6-compiler [...] perl.org
From: yary <not.com [...] gmail.com>
Download (untitled) / with headers
text/plain 1.2k
I'm a little confused by this report. The two code snippets are exactly the same- I checked with "diff". Does the same code have different results with different runs, or is there a copy/paste error? Also is the space between the brackets in "class B{ }" significant (the other two empty bracket pairs have no space)? -y On Tue, Aug 28, 2012 at 2:43 AM, Moritz Lenz <perl6-bugs-followup@perl.org> wrote: Show quoted text
> > # New Ticket Created by Moritz Lenz > # Please include the string: [perl #114634] > # in the subject line of all future correspondence about this issue. > # <URL: https://rt.perl.org:443/rt3/Ticket/Display.html?id=114634 > > > > "Just because it's an A doesn't mean it can't be a B" > > Consider > > { > my class A {}; > my class B { }; > my class C is B is A {}; > multi f(A) { "A" }; > multi f(B) { "B" }; > sub g(A $x) { say f($x) }; # type A > g(C.new); > } > > # prints A > > { > my class A {}; > my class B { }; > my class C is B is A {}; > multi f(A) { "A" }; > multi f(B) { "B" }; > sub g(A $x) { say f($x) }; # type A > g(C.new); > } > > # prints B > > and with the optimizer turned off, both print > > Ambiguous call to 'f'; these signatures all match: > :(A ) > :(B ) > > > Found by sorear++
Subject: Re: [perl #114634] over-eager multi dispatcher optimization
Date: Tue, 28 Aug 2012 10:08:22 -0700
To: perl6-compiler [...] perl.org
From: Stefan O'Rear <stefanor [...] cox.net>
Download (untitled) / with headers
text/plain 799b
On Tue, Aug 28, 2012 at 09:15:41AM -0400, yary wrote: Show quoted text
> I'm a little confused by this report. The two code snippets are > exactly the same- I checked with "diff". Does the same code have > different results with different runs, or is there a copy/paste error? > Also is the space between the brackets in "class B{ }" significant > (the other two empty bracket pairs have no space)?
There is in fact a copy-paste error. Here's the original, notice the changing signature of &g: sorear$ ./install/bin/perl6 Show quoted text
> { my class A {}; my class B { }; my class C is B is A {}; multi f(A) { "A" }; multi f(B) { "B" }; sub g(A $x) { say f($x) }; g(C.new); }
A Show quoted text
> { my class A {}; my class B { }; my class C is B is A {}; multi f(A) { "A" }; multi f(B) { "B" }; sub g(B $x) { say f($x) }; g(C.new); }
B -Stefan
Download (untitled)
application/pgp-signature 195b

Message body not shown because it is not plain text.



This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org