On Thu, 2005-02-03 at 19:58, Terje Slettebø wrote:
> > From: "Stig S. Bakken" <[EMAIL PROTECTED]>
> >
> > On Thu, 3 Feb 2005, Sebastian Bergmann wrote:
> >
> > > Andi Gutmans wrote:
> > > > Comments/Flames/Praises to this list :)
> > >
> > >  Just curious: Have you considered adding the operator overloading
> > >  patch [1] by Johannes Schlüter that has been floating around for a
> > >  while?
> >
> > Operator overloading in PHP?  Over my smoking carcass!
> >
> > PHP 5 returns object handles, which lets you do _exactly_ the same thing,
> > only without the obscurity.
> 
> You mean $a + $b? add($a, $b) is _not_ "exactly the same thing".
> 
> > Nobody needs overloaded operators.  Code should be readable, not
> > cuddly-cute.
> 
> Hm, I'm surprised by this response from someone who's name I recognise as an
> active PHP contributor. The answer strikes me as either arrogant and/or
> ignorant (note: I'm not saying you are that, but that's how the reply comes
> across, given what what operator overloading is about). As I've pointed out
> in other postings in this thread, operator overloading is about much more
> than "just" "syntactic sugar". In C++, for example, it enables important
> things such as function objects (being able to pass an object to a function,
> for example, and have it behave as a function, enabling functional
> programming, as well). This is not possible (possibly without jumping
> through major hoops) in PHP.
> 
> However, I see from this and other threads, that there's not much chance of
> evolution of PHP to support more "advanced" features (which are common in
> other scripting languages, as mentioned). It seems basic OO support is about
> the only thing the PHP community can handle when it comes to expressiveness
> in the language. Oh, well.
> 
> Oh, and the comment about "Code should be readable, not cuddly-cute":
> Operator overloading is about being able to express your intent clearer in
> the code - leading to _more_ readable code than the corresponding function
> alternative (see my arithmetic example in another posting). It has nothing
> to do with cuteness, and everything to do with being to express your intent
> clearly in the code. But it seems the community isn't ready for this. Too
> bad. Maybe in PHP 10.

My take on this is that you are, in many more cases than not, able to
express your intent much clearer with good method names.  This is
especially true if operator overloading were not part of the language
initially.  Your example with complex math is an exception.

Please explain how you see operator overloading making functional
programming possible/easier in PHP?

 - Stig

-- 
"Nearly all men can stand adversity, but if you want to test a man's
character, give him power." - Abraham Lincoln

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to