Here's a demo script:
#!/usr/bin/pugs
use v6;

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

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

my $foo = Foo.new(date => 'blah');

=cut

>pugs test.pl
ok
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 =:
\{obj:Class}
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.

Cheers,
Carl

Reply via email to