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

calling functions/class methods

Thread Next
From:
Ph. Marek
Date:
January 30, 2004 03:47
Subject:
calling functions/class methods
Message ID:
200401301239.15399.philipp.marek@bmlv.gv.at
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
	http://www.cuj.com/documents/s=8042/cuj0002meyers/

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

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 
parameter.
- 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.


Regards,

Phil


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