Minimal code:
#!/usr/bin/raku
class Widget {
submethod TWEAK(:$content, :$styles) {
say "t1\n";
}
}
class File is Widget {
submethod BUILD() {
say "b1";
}
}
my $xml = File.new();
And the output:
t1
b1
To quote from the relevant doc:
After the BUILD methods have been called, methods named TWEAK are called, if they exist, again with all the named arguments that were passed to new.
So why is TWEAK
being hit before BUILD
?
I'm using the version of Rakudo that comes with Fedora 32 (rakudo-0.2020.02-1.fc32.x86_64).