On Thu, Mar 11, 2004 at 11:38:11AM +0000, Andy Wardley wrote:
: Larry Wall wrote:
: >     multi sub *scramble (String $s) returns String {...}
: [...]
: > Or you can just call it directly as a function:
: >     scramble("hello")
: 
: Can you also call scramble as a class method?
: 
:   class String is extended {
:      method scramble { ..etc... }
:   }
: 
:   String.scramble("hello")

Not unless you write a class method that takes an extra argument.
Otherwise you're passing a class where it expects a string, and a
string where it expects nothing.  However, much like in Perl 5 you
can always force which class's method to call with

    "hello".String::scramble();

Larry

Reply via email to