new / BUILD errors

Skip to first unread message

Carl Franks

May 31, 2005, 6:40:35 AM5/31/05
to perl6-compiler
Here's a demo script:
use v6;

class Foo {
multi method new (Class $class: Str $date) {
say "ok";
return $ => $date);

submethod BUILD (+$date) {
say "date: '$date'";

my $foo = => 'blah');


date: ''

Problem 1:
I call the constructor with a named argument, so I expect my explicit
'new' method to _not_ get called, and for the default 'new' method
inherited from Class to get called.
However, "ok" is printed, showing my 'new' method is called.

Problem 2:
As shown in the output above, $date in BUILD is undef.

Also, if I add
say $class.perl;
inside of my 'new' method, it prints =:
Is this correct? Should it not be \{obj:Class} ?

If someone can confirm the problems above are bugs, I'll add tests to
the test suite for it.
I'm running pugs svn version 4201.


Reply all
Reply to author
0 new messages