On March 28, 2020 1:25:11 PM GMT+01:00, "Christoph M. Becker" 
<cmbecke...@gmx.de> wrote:
>On 28.03.2020 at 10:22, Arnold Daniels wrote:
>
>> This issues become even more apparent when sequencing operations like
>`$a +
>> $b + $c - $d`. Trying left, then trying right, will make it very
>difficult
>> to determine the outcome of such a statement.
>>
>> The arguments against type hinting for operator methods, assume the
>"try
>> left/right" method. Instead, type hinting should be applied to
>determine
>> which method should be used. If both or neither methods are
>applicable, an
>> error must be thrown.
>
>This "try left/right" approach is how operator overloading works for
>internal classes[1], and apparently, it works quite well, as long as it
>is not overused.


The fact that it works in one or two cases as an implementation detail where 
the full implementation is controlled by a single group (internals) is no 
indication for it to work at large.

>> With class inheritance, you also don't want to rely on the order of
>>the

Inheritance is always complex. Yes operator handling (especially if type 
dispatching happens manually) will add a few things to think about. Certainly 
an interesting field to explore, before one votes. I myself consider larger 
inheritance structures a thing of the 90ies and for special cases like GUI 
widgets ... but yeah, language design has to consider it. Changing languages 
features like discussed here in future is hard.

johannes

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

Reply via email to