RE: [PHP-DEV] Re: [VOTE] Userspace operator overloading

2020-03-26 Thread jan.h.boehmer
On Thursday, March 26, 2020 6:19 PM Guilliam Xavier wrote: >> If the concat operator is not overloaded, the behavior is like now, and the >> objects are converted implicitly to strings (so $a . $b actually means >> (string) $a . (string) $b). >> Furthermore an notice is triggered, hinting the

Re: [PHP-DEV] Re: [VOTE] Userspace operator overloading

2020-03-26 Thread Christoph M. Becker
On 26.03.2020 at 18:18, Guilliam Xavier wrote: > On Thu, Mar 26, 2020 at 5:37 PM wrote: >> >> The overloaded concat operator has higher priority than the __toString() >> method. >> So if Class A overloades the concat operator, then calling $a . $b means >> ClassA::__concat($a, $b); (Note that

Re: [PHP-DEV] Re: [VOTE] Userspace operator overloading

2020-03-26 Thread Guilliam Xavier
On Thu, Mar 26, 2020 at 5:37 PM wrote: > > The overloaded concat operator has higher priority than the __toString() > method. > So if Class A overloades the concat operator, then calling $a . $b means > ClassA::__concat($a, $b); (Note that both operands are passed in their > original form) >

RE: [PHP-DEV] Re: [VOTE] Userspace operator overloading

2020-03-26 Thread jan.h.boehmer
On Thursday, March 26, 2020 3:50 AM Jakob Givoni wrote: > On Wed, Mar 25, 2020 at 6:28 AM Christoph M. Becker wrote: > >> It seems to me that the RFC is not sufficiently specific enough >> regarding the concatenation of instances of classes which implement >> __toString(). > > Exactly what I

Re: [PHP-DEV] Re: [VOTE] Userspace operator overloading

2020-03-25 Thread Jakob Givoni
On Wed, Mar 25, 2020 at 6:28 AM Christoph M. Becker wrote: > > It seems to me that the RFC is not sufficiently specific enough > regarding the concatenation of instances of classes which implement > __toString(). Exactly what I was thinking too. Would be nice with some examples on this. > So if

[PHP-DEV] Re: [VOTE] Userspace operator overloading

2020-03-25 Thread Christoph M. Becker
On 23.03.2020 at 18:58, jan.h.boeh...@gmx.de wrote: > I have opened voting on > https://wiki.php.net/rfc/userspace_operator_overloading, which allows users > to overload operators in their own classes. It seems to me that the RFC is not sufficiently specific enough regarding the concatenation of

[PHP-DEV] Re: [VOTE] Userspace operator overloading

2020-03-24 Thread Mark Randall
On 23/03/2020 17:58, jan.h.boeh...@gmx.de wrote: I have opened voting on https://wiki.php.net/rfc/userspace_operator_overloading, which allows users to overload operators in their own classes. I am certainly not opposed to operator overloading, and would like to see it in the language.