develooper Front page | perl.perl6.language | Postings from January 2004

calling functions/class methods

Thread Next
Ph. Marek
January 30, 2004 03:47
calling functions/class methods
Message ID:
Hello everybody,

first of all please forgive me if I'm using the wrong words - I'm not up to 
date about the (current) meanings of methods, functions, etc.

I read the article

There is stated (short version - read article for details):
In C++ there are member functions, which are called via
and non-member (possibly friend) function, which are called via

I wondered whether perl6 could do both:
- When called via object.member, look for a member function; if it is not 
found, look for a function with this name, which takes an object as first 
- When called the other way, look first for the function, then for a member.

So both ways are possible, and in the (not-interfering) normal situation (only 
one of member/function defined) it would support encapsulation, in that a 
caller does not need to know if this function was a member or not.

I fear that I'm on a completly wrong track, or that this has been decided - 
but I didn't find something about this.



Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About