Re: com php-src: Array addition is not commutative: Zend/zend_vm_def.h Zend/zend_vm_execute.h Zend/zend_vm_opcodes.c

From: Date: Mon, 18 Dec 2017 06:52:50 +0000
Subject: Re: com php-src: Array addition is not commutative: Zend/zend_vm_def.h Zend/zend_vm_execute.h Zend/zend_vm_opcodes.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-100630@lists.php.net to get a copy of this message
On Dec 15, 2017 6:09 PM, Nikita Popov <nikita.ppv@gmail.com> wrote: On Fri, Dec 15, 2017 at 4:04 PM, Nikita Popov <nikita.ppv@gmail.com<mailto:nikita.ppv@gmail.com>> wrote: On Fri, Dec 15, 2017 at 12:40 PM, Dmitry Stogov <dmitry@php.net<mailto:dmitry@php.net>> wrote: Commit: 66a604171cc676ebc8cb717437f6b9cd589d3d24 Author: Dmitry Stogov <dmitry@zend.com<mailto:dmitry@zend.com>> Fri, 15 Dec 2017 14:40:19 +0300 Parents: 588f1df7a24867a43e9574b57957e6fca2518c17 Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=66a604171cc676ebc8cb717437f6b9cd589d3d24 Log: Array addition is not commutative If operator overloading for objects is used, then mul is also not necessarily commutative. E.g. multiplication on two Matrix objects is not commutative. Nikita In general, I think doing this is only really safe for IS_IDENTICAL and IS_NOT_IDENTICAL. For everything else there may be issues due to operator overloading or comparison overloading. Though probably IS_EQUAL and IS_NOT_IDENTICAL are fine as well, non-commutative equality would be very weird. Nikita Hi Nikita, I'm not sure how to proceed. From one hand, you are right, and stating MUL and others as COMMUTATIVE, may make troubles for some furure extensions. On the other hand, we don't have such extensions, and it's pitty to limit ourselves in optimizing PHP for the usual code. I can write a mini RFC, to make a common decision. Thanks. Dmitry.

« previous php.cvs (#100630) next »