On Fri, Dec 06, 2002 at 12:27:31PM -0700, Luke Palmer wrote:
: > Date: Fri, 06 Dec 2002 11:15:20 -0800
: > From: Larry Wall <[EMAIL PROTECTED]>
: >
: > As for constructor syntax, I suppose we might make use of the $. notation
: > like this:
: >
: > method new($.name, $.age) {
: > return $class.bless;
: > }
:
: Come to think of it, new is a class method, not an object method. How
: is that specified again? Is there going to be sugar to blur that
: distinction for constructors?
You'll not that $class was declared typeless, so it doesn't matter if it was
actually a class or an object of that class.
Actually, that last example was wrong--it should have been
method new($.name, $.age) {
return .bless;
}
or
method new($class: $.name, $.age) {
return $class.bless;
}
But in either case, if $class is untyped, it can work with either cloning
or class-based constructors.
Larry