Edit report at https://bugs.php.net/bug.php?id=9331&edit=1

 ID:                 9331
 Comment by:         f3n6s at objectmail dot com
 Reported by:        jgsmith at tamu dot edu
 Summary:            No operator overloading available
 Status:             Bogus
 Type:               Feature/Change Request
 Package:            Feature/Change Request
 Operating System:   Irix 6, Solaris 7, OpenBSD 2.8
 PHP Version:        4.0.4pl1
 Block user comment: N
 Private report:     N

 New Comment:

Saying "such a feature won't go in PHP's core."  Is tantamount to saying "There 
shall never be operator overloading in PHP"  since, if it's not in the core, 
nobody can use it practically!  Fine. Don't put it in the core.  Put it on the 
back of a flying monkey. I don't care.  But /enable/ it by default so people 
can use it.

Second- mysterious eyebrow raising followed by "well i dunno.. thre are many 
problems, what if we want to vardump an array operator overloard object" and 
whatnot is completely backwards.

You have destroyed and forgotten and thrown away everything that was once great 
about PHP.  If such eyebrow raising had occurred when you added __get and 
__set, and heebee-jeebee about "proper object oriented design", then those 
would never have made it in.  Same for a milion other features that made PHP 
unique and special, capable of things other languages just /couldn't do/.

Third, it's been written!  575 lines of clean, simple, straightforward code 
sitting there on PECL.  Dare-I-say, even /trivial/!

And as for the comments of "oh, well, there are side effects we would have to 
work out..."  If I don't want the side effects then I won't use the construct.  
 __toString has /side/effects!  

As I said, there were things; humble things; that once made PHP great.  But 
around the time that Zend and SPL and the rest of that junk came out, those 
things became less important, and PHP has incrementally become just like every 
other langauge out there.  

In response to this little gem form the "php manual user note system":

  - Your disdain for PHP and/or its maintainers. Go learn FORTRAN instead. 

Well heck, why don't we all go use JAVA if we wanna do "proper OOP".  

I'd much rather do cool things in half the time.

/rant


Previous Comments:
------------------------------------------------------------------------
[2007-11-27 11:12:28] johan...@php.net

There's an operator overloading extension, see pecl.php.net -> search for 
"operator" but such a feature won't go in PHP's core.

------------------------------------------------------------------------
[2007-11-27 10:51:31] C01t dot te at gmail dot com

Operator overloading will open a new chapter in PHP's objects usage.

And I think that perhaps it could be done through interfaces. May be included 
in SPL. 

For example

interface MathOperators
{
   function operatorAdd($object);
   function operatorSub($object);
   function operatorMul($object);
   function operatorDiv($object);
   function operatorInc($object);
   function operatorDec($object);
}

One who needs these functionality just implements this interface (or interfaces 
for each operation) and here it is, and operator overloading :-)

------------------------------------------------------------------------
[2007-08-11 07:58:14] nibujoshua at gmail dot com

it is very bad, that there is no operator overloding capability for PHP

------------------------------------------------------------------------
[2007-04-21 16:49:14] dionyziz at deviantart dot com

I think there are many other people who would like to see this feature 
implemented. Is there any chance it could be made available in PHP6?

------------------------------------------------------------------------
[2001-02-20 01:00:44] an...@php.net

I hardly believe this will be implemented anytime soon or
accepted at all,
suspending (for the records)

------------------------------------------------------------------------


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    https://bugs.php.net/bug.php?id=9331


-- 
Edit this bug report at https://bugs.php.net/bug.php?id=9331&edit=1

Reply via email to