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


<ash_> rakudo: class A { has $!a }; my $a = A.new(a => 42); my $method
= method { return $!a }; $a.$method().say;
<p6eval> rakudo c41cf3: OUTPUT«42␤»
<ash_> should that be allowed?
<moritz_> ash_: rakudo doesn't really enforce privateness of
attributes in any case
<moritz_> ash_: but I don't think it should be allowed
<ash_> got ya
<ash_> some languages have different ideas of 'private', but most
languages with reflection end up having all their variables public,
eventually
<TimToady> the compiler should have no idea what $!a means outside the
class's block, I think
<ash_> so, a bare "my $a = method { $!a }" would be a compiler error?
<ash_> by bare i mean, outside a class definition
<TimToady> outside of anyplace that doesn't define $!a
<TimToady> including inside a different class definition

Reply via email to