develooper Front page | perl.perl6.language | Postings from October 2001

Re: A3, the ';' operator, and hyper-operators

Thread Previous | Thread Next
From:
Damian Conway
Date:
October 9, 2001 02:29
Subject:
Re: A3, the ';' operator, and hyper-operators
Message ID:
200110090928.TAA04689@indy05.csse.monash.edu.au
   > Please tell me there will be a way to work out if you're called as a
   > subroutine or as a method.

Yes. Subroutines and methods will inhabit different namespaces
(modules and classes respectively):

        module X;

        sub s { print "I am the very model of a modern Perl 6 subroutine\n" }


        class X {

                method s { print "I'm trying to be objective here\n" }
        }


        X::s();         # I am the very model...
        X.s();          # I'm trying to be...


Though I'm by no means certain that Larry will allow both a module X and a
class X at the same time.

Damian

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About