--- Nicholas Clark <[EMAIL PROTECTED]> wrote:
> This wasn't quite what I was thinking about. I was more for typing
> laziness (and avoiding cut&paste) - I'd like a default for the
> instance initialiser, but only to be used (by the compiler's code
> generator) if I don't specify a specific initialiser in that
> (overloaded) constructor.
Would that be:
class X {
has $.attr1;
has $.attr2;
method new($class: ?$.attr1, ?$.attr2) {
$.attr1 //= 0; # Default value
$.attr2 //= 0; # Default value
}
}
Where the $.attr1 syntax is the already-discussed
"quick-constructor-assign" shortcut, and the //= allows you to specify
a default if the arglist failed?
=Austin