# New Ticket Created by  "Carl Mäsak" 
# Please include the string:  [perl #102478]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org:443/rt3/Ticket/Display.html?id=102478 >


<moritz> nom: class A { eval 'has $.x' }; say A.new(x => 3).x
<p6eval> nom 9c6aed: OUTPUT«===SORRY!===␤A  cannot have attributes at
line 1, near ""␤»
<moritz> nom: class A { BEGIN eval 'has $.x' }; say A.new(x => 3).x
<p6eval> nom 9c6aed: OUTPUT«===SORRY!===␤A  cannot have attributes at
line 1, near ""␤»
<moritz> why not?
<jnthn> moritz: Probably that eval doesn't know it's in a class
definition or some such
<jnthn> moritz: e.g. it's treated like a little bit of mainline
<jnthn> moritz: I guess you can argue that the BEGIN case there should work
<moritz> jnthn: but the error message knows that it's in A
<jnthn> moritz: no, the error message is busted
<jnthn> The first case should certainly not work
<jnthn> The second one...maybe.
<jnthn> So the question is...
<jnthn> In eval, what do we treat as the current package?
<jnthn> masak: The "A" in the error messsage is not referring to the clas A
<jnthn> Call it B in the code to see :)
<masak> jnthn: aha, it's an article ;)
<jnthn> nom: class B { BEGIN eval 'has $.x' }
<p6eval> nom 9c6aed: OUTPUT«===SORRY!===␤A  cannot have attributes at
line 1, near ""␤»
<jnthn> See the double space? :)
<jnthn> It doesn't know what sort of thing it is in :)
<jnthn> nom: has $.x
<p6eval> nom 9c6aed: OUTPUT«===SORRY!===␤A  cannot have attributes at
line 1, near ""␤»
<jnthn> Right. :)
<jnthn> eval is doing the wrong kind of thing about current package.
* masak submits rakudobug
<jnthn> Yeah, we should probably make that one work.
<jnthn> I'm in the middle of re-doing the repr API at the moment
though, so won't get to that for a day or two.

Reply via email to