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

submethod BUILD called twice during object construction #785

Closed
p6rt opened this issue Mar 15, 2009 · 5 comments
Closed

submethod BUILD called twice during object construction #785

p6rt opened this issue Mar 15, 2009 · 5 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Mar 15, 2009

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

Searchable as RT63900$

@p6rt
Copy link
Author

p6rt commented Mar 15, 2009

From @moritz

Rakudo 087e299898416ca6c3a6e2b2bdc3785d841f0ec6​:
./perl6 -e 'class P { submethod BUILD($o) { say self.WHAT; $o.shout } };
class C is P { method shout { say "alive" } }; C.new()'
P
alive
C
alive

The submethod BUILD is called twice here, once for the parent and once
for the
child class. If the child class defines such a submethod itself, each is
only
called once and all is fine​:

$./perl6 -e 'class P { submethod BUILD($o) { say self.WHAT; $o.shout }
}; class C is P { submethod BUILD($o) { say "in child" }; method shout {
say "alive" } }; C.new()'
P
alive
in child

--
Moritz Lenz
http://perlgeek.de/ | http://perl-6.de/ | http://sudokugarden.de/

@p6rt
Copy link
Author

p6rt commented Jul 17, 2009

From @kyleha

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

@p6rt
Copy link
Author

p6rt commented Jul 17, 2009

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

@p6rt
Copy link
Author

p6rt commented Jul 30, 2009

From @moritz

fixed by jnthn++, tests unfudged.

@p6rt
Copy link
Author

p6rt commented Jul 30, 2009

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

@p6rt p6rt closed this as completed Jul 30, 2009
@p6rt p6rt added the Bug label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant