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

The presence of a new($) multi method breaks attribute initialization #1673

Closed
p6rt opened this issue Apr 12, 2010 · 5 comments
Closed

The presence of a new($) multi method breaks attribute initialization #1673

p6rt opened this issue Apr 12, 2010 · 5 comments

Comments

@p6rt
Copy link

p6rt commented Apr 12, 2010

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

Searchable as RT74300$

@p6rt
Copy link
Author

p6rt commented Apr 12, 2010

From @moritz

11​:07 <@​moritz_> rakudo​: class A { has $.a; multi method new ($){ } };
say A.new(​:a<b>).a
11​:07 < p6eval> rakudo 0334df​: OUTPUT«Any()␤»
11​:08 <@​moritz_> that bit me while writing Date.pm
11​:08 <@​moritz_> not sure if it's allowed by spec or not
11​:08 < masak> er.
11​:09 < masak> you're returning nothing from the method?
11​:09 < masak> shouldn't you be getting Nil back?
11​:09 <@​moritz_> I'm not calling that method
11​:09 < masak> ah, true.
11​:09 <@​moritz_> I think it's a bug
11​:09 < masak> so do I.
11​:09 <@​moritz_> because either it finds the default method, then the
initialization should work
11​:10 <@​moritz_> or it doesn't find the method, then it should die horribly
11​:10 < masak> aye.
11​:10 < masak> seems kinda weird...
11​:10 <@​moritz_> rakudo​: class A { has $.a }; say A.new(​:a<b>).a
11​:10 < masak> rakudo​: class A { has $.a; multi method new ($){ say "OH
HAI" }}; say A.new(​:a<b>)
11​:10 < p6eval> rakudo 0334df​: OUTPUT«b␤»
11​:10 < p6eval> rakudo 0334df​: OUTPUT«A()<0x5ebcbe8>␤»

@p6rt
Copy link
Author

p6rt commented Sep 30, 2011

From @coke

On Mon Apr 12 02​:26​:38 2010, moritz wrote​:

11​:07 <@​moritz_> rakudo​: class A { has $.a; multi method new ($){ } };
say A.new(​:a<b>).a
11​:07 < p6eval> rakudo 0334df​: OUTPUT«Any()␤»
11​:08 <@​moritz_> that bit me while writing Date.pm
11​:08 <@​moritz_> not sure if it's allowed by spec or not
11​:08 < masak> er.
11​:09 < masak> you're returning nothing from the method?
11​:09 < masak> shouldn't you be getting Nil back?
11​:09 <@​moritz_> I'm not calling that method
11​:09 < masak> ah, true.
11​:09 <@​moritz_> I think it's a bug
11​:09 < masak> so do I.
11​:09 <@​moritz_> because either it finds the default method, then the
initialization should work
11​:10 <@​moritz_> or it doesn't find the method, then it should die horribly
11​:10 < masak> aye.
11​:10 < masak> seems kinda weird...
11​:10 <@​moritz_> rakudo​: class A { has $.a }; say A.new(​:a<b>).a
11​:10 < masak> rakudo​: class A { has $.a; multi method new ($){ say "OH
HAI" }}; say A.new(​:a<b>)
11​:10 < p6eval> rakudo 0334df​: OUTPUT«b␤»
11​:10 < p6eval> rakudo 0334df​: OUTPUT«A()<0x5ebcbe8>␤»

This looks ok now​:

19​:36 <[Coke]> rakudo​: class A { has $.a; multi method new ($){ } }; say
  A.new(​:a<b>).a
19​:36 <p6eval> rakudo ebd4d8​: OUTPUT«b␤»
19​:36 <[Coke]> rakudo​: class A { has $.a }; say A.new(​:a<b>).a
19​:36 <p6eval> rakudo ebd4d8​: OUTPUT«b␤»
19​:36 <[Coke]> rakudo​: class A { has $.a; multi method new ($){ say "OH HAI"
  }}; say A.new(​:a<b>)
19​:36 <p6eval> rakudo ebd4d8​: OUTPUT«A<75415200>␤»

Closable modulo tests, I think.

--
Will "Coke" Coleda

@p6rt
Copy link
Author

p6rt commented Sep 30, 2011

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

@p6rt
Copy link
Author

p6rt commented Dec 29, 2011

From @moritz

Now tested in S12-construction/new.t

@p6rt
Copy link
Author

p6rt commented Dec 29, 2011

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

@p6rt p6rt closed this as completed Dec 29, 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