Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rakudo doesn't access inherited private attributes correctly #507

Closed
p6rt opened this issue Dec 18, 2008 · 9 comments
Closed

Rakudo doesn't access inherited private attributes correctly #507

p6rt opened this issue Dec 18, 2008 · 9 comments

Comments

@p6rt
Copy link

p6rt commented Dec 18, 2008

Migrated from rt.perl.org#61500 (status was 'resolved')

Searchable as RT61500$

@p6rt
Copy link
Author

p6rt commented Dec 18, 2008

From @masak

<masak> rakudo​: class A { has $foo = 7; method x { say $!foo } }; A.new.x
<p6eval> rakudo 34088​: OUTPUT[7â�¤]
<masak> rakudo​: class A { has $foo = 7 }; class B is A { method x {
say $!foo } }; B.new.x
<p6eval> rakudo 34088​: OUTPUT[â�¤]
<masak> looks like a bug to me.
<lichtkind> i would say too
* masak submits
<masak> rakudo​: class A { has $!foo = 7 }; class B is A { method x {
say $!foo } }; B.new.x
<p6eval> rakudo 34088​: OUTPUT[â�¤]
<masak> oh, this has nothing to do with the absence of !

I'm not 100% sure this is an error. But it seems a bit strange to me.

@p6rt
Copy link
Author

p6rt commented Dec 21, 2008

From @masak

<masak> lichtkind​: it would seem to me that the error is that Rakudo
can see a $!foo from the B class. it should be a compile error,
methinks.
<masak> adding this as a comment to the ticket.
<lichtkind> masak​: this is just another privat method, and these
usually do inherit
<masak> oh.
<masak> I'm mostly from the Java world, where private things don't inherit.
<masak> well, either it should or it shouldn't inherit. if it should,
then the error is that we don't see a 7 in the second one-liner,
right?
<masak> to me, it's worrisome enough that B can see a $!foo.
<masak> but that might be correct, depending on how Perl 6 OO works.

@p6rt
Copy link
Author

p6rt commented Dec 21, 2008

From @masak

<masak> lichtkind​: found it!
<masak> lichtkind​: "the exclamation form may be used only in the
actual class, not in derived classes."
<masak> S12​:567
<masak> this needs spectests, to be sure
<masak> that also means that Rakudo is too permissive in this case
* masak adds this to the ticket

@p6rt
Copy link
Author

p6rt commented Jul 12, 2009

From @kyleha

This is an automatically generated mail to inform you that tests are now available in b/t/spec/S12-attributes/inheritance.t

@p6rt
Copy link
Author

p6rt commented Jul 12, 2009

The RT System itself - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Apr 23, 2010

From @bbkr

Moscow build​:

perl6 -e 'class A { has $!foo = 7 }; class B is A { method x {say $!foo
} }; B.new.x'
7

So now value is correct, but $!foo form should be forbidden in derived
class anyway due to S12 spec?

@p6rt
Copy link
Author

p6rt commented Sep 14, 2011

From @jnthn

On Thu Dec 18 15​:09​:45 2008, masak wrote​:

<masak> rakudo​: class A { has $foo = 7; method x { say $!foo } }; A.new.x
<p6eval> rakudo 34088​: OUTPUT[7â�¤]
<masak> rakudo​: class A { has $foo = 7 }; class B is A { method x {
say $!foo } }; B.new.x
<p6eval> rakudo 34088​: OUTPUT[â�¤]
<masak> looks like a bug to me.
<lichtkind> i would say too
* masak submits
<masak> rakudo​: class A { has $!foo = 7 }; class B is A { method x {
say $!foo } }; B.new.x
<p6eval> rakudo 34088​: OUTPUT[â�¤]
<masak> oh, this has nothing to do with the absence of !

I'm not 100% sure this is an error. But it seems a bit strange to me.

We get this right now​:

class A { has $!foo = 7 }; class B is A { method x { say $!foo } };
B.new.x
Attribute $!foo not declared in class B at line 1, near " } }; B.ne"

Tests needed, then can be closed.

/jnthn

@p6rt
Copy link
Author

p6rt commented Sep 14, 2011

From @tadzik

Tests needed, then can be closed.

/jnthn

Tests added in Raku/roast@78945cc460, can be
closed.

@p6rt
Copy link
Author

p6rt commented Sep 14, 2011

@jnthn - Status changed from 'open' to 'resolved'

@p6rt p6rt closed this as completed Sep 14, 2011
@p6rt p6rt added the testneeded label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant