Larry Wall <[EMAIL PROTECTED]> writes:
> On Sat, 12 Oct 2002, Me wrote:
> : We also need a signifier for class methods (assuming
> : a distinction is made).
> :
> : Perhaps one could use an initial cap to indicate a class
> : attribute/method:
> :
> : class foo {
> : my $bar; # my is not used for attributes
> : our $baz; # neither is our
> : has qux; # instance attribute
> : has Waldo; # class attribute
> : method qwe; # instance method
> : method Rty; # class method
> : }
> :
> : or similar.
>
> I prefer to keep caps distinctions conventional rather than mandatory.
> Maybe class methods could be indicated as in Ruby:
>
> method qwe; # instance method
> method foo.rty; # class method
>
> But that wouldn't work as well for an anonymous class...
>
> And Perl 5 certainly gets away without making the distinction.
> And confusing the two does help if you want to write constructors
> that can clone objects as well as create new ones. Perhaps they
> could be distinguished by the type of the invocant, if declared.
I like that idea:
class SomeClass {
method class_method ( Class $class : ... ) { ... }
method instance_method ( SomeClass $self : ... ) { ... }
method dont_care_method ( $self : ... ) { ... }
}
Or will 'Class' actually be CLASS by analogy with HASH, ARRAY etc?
--
Piers
"It is a truth universally acknowledged that a language in
possession of a rich syntax must be in need of a rewrite."
-- Jane Austen?