develooper Front page | perl.perl6.language | Postings from July 2005

Re: method calls on $self

Thread Previous | Thread Next
From:
Robin Redeker
Date:
July 9, 2005 02:47
Subject:
Re: method calls on $self
Message ID:
20050708182834.GA2353@elmex
On Fri, Jul 08, 2005 at 10:07:24AM -0400, Stevan Little wrote:
> 
> On Jul 8, 2005, at 2:10 AM, Robin Redeker wrote:
> >And what will be the default syntax to call
> >a method on self? If everyone has completly other
> >preferences about this, for example this horrible ./method()
> >syntax, which completly wont fit into the language, whose
> >favorite will be the default?
> >None at all?
> >An explicit call, like $?SELF.method () ?
> 
> I have never understood what is wrong with this:
> 
> method foo ($self: $bar) {
> 	$self.baz()
> }

Thats a fine option to have.
But therecomes another question to my mind:
what do i get with writing 'method' instead of
'sub'? is it just for seperating subroutines and methods optically
or is there a deeper reason?

> 
> Then you can easily so whatever you like:
> 
> ## for our Java inclined friends
> method foo ($this: $bar) {
> 	$this.baz()
> }

or C++

> 
> Why does it have to be some sugared syntax when you can just simple  
> name it in the parameter list?
> 

Yes, but there seem to be quite some people who want
a 'cool' syntax for it. (ie. ./method ()).

No syntax at all, like in C++ just method() would
be the shortest. But larry says no, and everyone seems to
agree.


robin

-- 
elmex@x-paste.de / robin@nethype.de
Robin Redeker

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