php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #66022 operator overloading bundle with future PHP versions?
Submitted: 2013-11-02 23:33 UTC Modified: 2017-10-24 23:03 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: worldoffame at hotmail dot com Assigned:
Status: Suspended Package: operator (PECL)
PHP Version: Irrelevant OS: Irrelevant
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: worldoffame at hotmail dot com
New email:
PHP Version: OS:

 

 [2013-11-02 23:33 UTC] worldoffame at hotmail dot com
Description:
------------
Its interesting that PHP has had operator overloading in PECL for such a long time, but never implemented with PHP core. 

Come to think about it, C# has operator overloading, Python has operator overloading, Ruby has operator overloading too. The only major programming language that can be used for server side programming without operator overloading is, Java! I thought PHP internals dont want PHP to behave/look like Java? 


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-11-07 03:43 UTC] phpmpan at mpan dot pl
-> and paamayim nekudotayim are supported for years using __get and friends.
`isset` and `empty` for not much less.
[] is supported with `ArrayAccess`.

= operator is not re-implementable for reference-only languages, because it doesn't refer to an object.

Comparison and large part of arithmetic operators are currently¹ not implementable in languages that are not strongly typed².

What can be added is:
 - unary + (have you ever used this one?) and unary -
 - / and %, but use cases are quite limited, especially in case of a WWW-centered language.
 - << and >>, with even more limited use cases
 - || and &&, but it could only be a couriosity.

___
¹ In theory they're implementable, but calls are prohibitely expensive. Beybe in future this will change.
² Neither Python nor PECL/operator really work. They just give illusion of having operators, but the solution is inherently broken.
 [2017-04-01 21:00 UTC] tpunt@php.net
-Package: operator +Package: *General Issues
 [2017-04-01 21:03 UTC] tpunt@php.net
-Package: *General Issues +Package: operator
 [2017-04-01 21:03 UTC] tpunt@php.net
I got confused...
 [2017-10-24 23:03 UTC] kalle@php.net
-Status: Open +Status: Suspended
 [2017-10-24 23:03 UTC] kalle@php.net
The operator PECL package have not had a release for 4 years and development activity seems to have ceased, if a new maintainer picks up this package, then this report should be re-opened
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 15:01:30 2024 UTC