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

Calling anonymous methods stored in public & attributes in Rakudo #883

Closed
p6rt opened this issue Apr 11, 2009 · 4 comments
Closed

Calling anonymous methods stored in public & attributes in Rakudo #883

p6rt opened this issue Apr 11, 2009 · 4 comments

Comments

@p6rt
Copy link

p6rt commented Apr 11, 2009

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

Searchable as RT64650$

@p6rt
Copy link
Author

p6rt commented Apr 11, 2009

From @masak

<jnthn> rakudo​: class Foo { has @​.body; has &.writer = method ($x) {
@​!body.push($x) }; }; my $x = Foo.new; $x.writer("oh");
$x.writer("hai"); .say for $x.body;
<p6eval> rakudo 5b679a​: OUTPUT«Could not locate a method 'writer' to
invoke on lass 'Foo'.
* masak submits rakudobug
<masak> rakudo​: class A { has &!m = method {}; method f { &!m() } }; A.new.f
<p6eval> rakudo 5b679a​: OUTPUT«No such attribute '!m' [...]
<masak> rakudo​: class A { has $!m = method { say "OH HAI {self}" };
method f { self.$!m() } }; A.new.f
<p6eval> rakudo 5b679a​: OUTPUT«OH HAI A<0xb6a19880>␤»
<masak> that works. :)
<masak> those & sigils on attributes don't work so well.

@p6rt
Copy link
Author

p6rt commented May 20, 2009

From @jnthn

On Sat Apr 11 14​:56​:36 2009, masak wrote​:

<jnthn> rakudo​: class Foo { has @​.body; has &.writer = method ($x) {
@​!body.push($x) }; }; my $x = Foo.new; $x.writer("oh");
$x.writer("hai"); .say for $x.body;
<p6eval> rakudo 5b679a​: OUTPUT«Could not locate a method 'writer' to
invoke on lass 'Foo'.
* masak submits rakudobug
<masak> rakudo​: class A { has &!m = method {}; method f { &!m() } };
A.new.f
<p6eval> rakudo 5b679a​: OUTPUT«No such attribute '!m' [...]
<masak> rakudo​: class A { has $!m = method { say "OH HAI {self}" };
method f { self.$!m() } }; A.new.f
<p6eval> rakudo 5b679a​: OUTPUT«OH HAI A<0xb6a19880>␤»
<masak> that works. :)
<masak> those & sigils on attributes don't work so well.

Fixed in git 60f709d and spectests added to S12-attributes/instance.t.

Thanks,

Jonathan

@p6rt
Copy link
Author

p6rt commented May 20, 2009

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

@p6rt
Copy link
Author

p6rt commented May 20, 2009

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

@p6rt p6rt closed this as completed May 20, 2009
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant