Who knows whether $foo->new creates a new, empty object of the same class or a complete copy of $foo. It's not clear unless you read the docs or the source code.Well, unless you read the docs or the source code, you don't know whether
returns an object of class Class, or something else.Class->new
Or more generally, unless you read the docs or the source code, you don't know what random_function or random_method is going to return anyway.
OTOH, I've yet to encounter code where
isn't a constructor of the class Class, or to encounter code whereClass->new
was called, and it returned something else than (ref $foo)->new.$foo->new
Good OO programming practice is that class methods and object methods should be distinct. I think that it's a shame that common Perl practice seems to be to ignore that practice as it makes OO programming in Perl seem more complex than it needs to be.Man, of all the problems of doing OO in Perl, the lack of separation between class and object methods looks incredibly minor to me.
In reply to Re^6: bless with => separated args
by Anonymous Monk
in thread bless with => separated args
by jaa
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |