Req #72589 [Opn->Sus]: "OR" is used differently
Edit report at https://bugs.php.net/bug.php?id=72589&edit=1
ID: 72589
Updated by: stas@php.net
Reported by: xxalfa at gmail dot com
Summary: "OR" is used differently
-Status: Open
+Status: Suspended
Type: Feature/Change Request
Package: *General Issues
Operating System: macOS 10.11.5
PHP Version: 7.0.8
Block user comment: N
Private report: N
New Comment:
Thank you for your interest in PHP and for submitting a feature request. Please be aware that due to
the magnitude of change this request requires, it would be necessary to discuss it on PHP Internals
list (internals@lists.php.net) as an RFC. Please read the guide about creating RFCs here:
https://wiki.php.net/rfc/howto
If you haven't had experience with writing RFCs before, it is advised to seek guidance on the
Internals list (http://php.net/mailing-lists.php) and/or solicit help from one of the experienced
developers.
Please to not consider this comment as a negative view on the merits of your proposal - every
proposal which requires changes of certain magnitude, even the very successful and widely supported
ones, must be done through the RFC process. This helps make the process predictable, transparent and
accessible to all developers.
Previous Comments:
------------------------------------------------------------------------
[2016-07-13 17:14:12] cmb@php.net
> @cmb recognizes it well, you need a negation.
Then we might as well introduce unless, see
<http://docstore.mik.ua/orelly/perl4/prog/ch04_03.htm>.
------------------------------------------------------------------------
[2016-07-13 17:06:10] xxalfa at gmail dot com
@nikic I thank you for your detailed thoughts.
@cmb recognizes it well, you need a negation.
------------------------------------------------------------------------
[2016-07-13 11:05:15] cmb@php.net
Should have been
if (!$test) exit;
------------------------------------------------------------------------
[2016-07-13 11:03:19] cmb@php.net
And all that so one could write
$test or exit;
instead of
if ($test) exit;
Doesn't make sense to me.
------------------------------------------------------------------------
[2016-07-13 10:41:13] nikic@php.net
@kalle: There's not really a technical problem here, just needs a change in grammar and dummy
return value.
This will need an RFC though. I'm personally not a fan of this, because I consider it bad
style.
Also consider what specifically you want to allow. Do you want to special-case the "or"
operator (bad idea imho) or do we end up allowing "1 + throw $x" (consistent, but meh)?
Also consider the precedence of these new "operators". What does "true or return 1 or
return 2" do? Is it "true or (return 1) or (return 2)" or is it "true or (return
(1 or (return 2)))?
Lastly, consider which statements you want to convert to expressions. All "jump"
operations, i.e. throw, return, break, continue, goto? Or more than that? Do you want to allow
"true or unset($var)"? Do you want to allow "true or foreach ($x as $y) { ...
}"? Etc.
------------------------------------------------------------------------
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=72589
--
Edit this bug report at https://bugs.php.net/bug.php?id=72589&edit=1
Thread (9 messages)