develooper Front page | perl.perl6.compiler | Postings from March 2012

[perl #111986] &fail always stringifies its arguments

From:
Moritz Lenz
Date:
March 25, 2012 13:33
Subject:
[perl #111986] &fail always stringifies its arguments
Message ID:
rt-3.6.HEAD-4610-1332707601-1828.111986-82-0@perl.org
# New Ticket Created by  Moritz Lenz 
# Please include the string:  [perl #111986]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org:443/rt3/Ticket/Display.html?id=111986 >


22:29 < moritz> nom: class A is Exception { }; my $x = fail A.new; say
                $x.exception.WHAT
22:29 <+p6eval> rakudo a4c78f: OUTPUT«X::AdHoc()␤»

Should be A(), not X::AdHoc. That's because somewhere along the way,
fail() stringifies its arguments, and then the exception is wrapped in
X::AdHoc, because the stringified thing isn't of type Exception anymore.

Note that with "use fatal" in effect, it works as designed:

22:32 < moritz> nom: class A is Exception { }; use fatal; try fail
A.new; say $!.WHAT
22:32 <+p6eval> rakudo 008dd4: OUTPUT«A()␤»



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