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

2020-03-13 Thread Jan Böhmer
On Thu, 12 Mar 2020 at 10:06, rowan.coll...@gmail.com wrote: On Thu, 12 Mar 2020 at 08:31, Jan Böhmer wrote: On 11.03.2020 at 10:50, Christoph M. Becker wrote: > On 11.03.2020 at 10:22, Nikita Popov wrote: >> Does anyone else have thoughts on the ability to specify the supported >> types in th

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

2020-03-12 Thread Rowan Tommins
On Thu, 12 Mar 2020 at 08:31, Jan Böhmer wrote: > On 11.03.2020 at 10:50, Christoph M. Becker wrote: > > On 11.03.2020 at 10:22, Nikita Popov wrote: > >> Does anyone else have thoughts on the ability to specify the supported > >> types in the signature? > > I agree that we should not introduce (t

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

2020-03-12 Thread Jan Böhmer
On 11.03.2020 at 10:50, Christoph M. Becker wrote: On 11.03.2020 at 10:22, Nikita Popov wrote: On Fri, Mar 6, 2020 at 9:17 AM Jan Böhmer wrote: Am 02.03.2020 um 15:30 schrieb Nikita Popov: On Thu, Feb 27, 2020 at 9:43 PM wrote: If the operator handler function declares typehints (e.g. p

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

2020-03-11 Thread Christoph M. Becker
On 11.03.2020 at 10:22, Nikita Popov wrote: > On Fri, Mar 6, 2020 at 9:17 AM Jan Böhmer wrote: > >> Am 02.03.2020 um 15:30 schrieb Nikita Popov: >> >>> On Thu, Feb 27, 2020 at 9:43 PM wrote: >>> If the operator handler function declares typehints (e.g. public static function __add(Vect

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

2020-03-11 Thread Nikita Popov
On Fri, Mar 6, 2020 at 9:17 AM Jan Böhmer wrote: > Am 02.03.2020 um 15:30 schrieb Nikita Popov: > > On Thu, Feb 27, 2020 at 9:43 PM wrote: > >> On 15/02/2020 22:05, jan.h.boeh...@gmx.de wrote: >> > Hi internals, >> > >> > based on the discussions here (https://externals.io/message/108300) and >>

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

2020-03-06 Thread Jan Böhmer
Am 02.03.2020 um 15:30 schrieb Nikita Popov: On Thu, Feb 27, 2020 at 9:43 PM mailto:jan.h.boeh...@gmx.de>> wrote: On 15/02/2020 22:05, jan.h.boeh...@gmx.de wrote: > Hi internals, > > based on the discussions here (https://externals.io/message

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

2020-03-03 Thread Rowan Tommins
On Tue, 3 Mar 2020 at 14:45, Terje Slettebø < terje.slett...@sandefjordbredband.net> wrote: > > I agree that this makes sense. However, as someone else pointed out, one > problem with interfaces is that they constrain the types that may be used. > An interface doesn't have to define types, and i

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

2020-03-03 Thread Terje Slettebø
Hi Rowan. I agree that this makes sense. However, as someone else pointed out, one problem with interfaces is that they constrain the types that may be used. We have our own Money, Percentage, PricePerMm, etc. types that we'd like to define operators for, how can you define an interface in PH

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

2020-03-03 Thread Rowan Tommins
Hi Terje, I think both of your examples are compatible with the idea of grouped operators, as long as we don't constrain a type to implement all operators with the same right-hand side. On Mon, 2 Mar 2020 at 17:23, Terje Slettebø < terje.slett...@sandefjordbredband.net> wrote: > > Adding and su

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

2020-03-02 Thread Mike Schinkel
> On Mar 2, 2020, at 9:30 AM, Nikita Popov wrote: > > On Thu, Feb 27, 2020 at 9:43 PM wrote: > >> I have changed the proposed names for the bitshift handlers to '__lshift' >> and '__rshift' (instead of __sl and __sr) to make more clear what operator >> is handled by the method (also the method

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

2020-03-02 Thread Rowan Tommins
On Mon, 2 Mar 2020 at 14:30, Nikita Popov wrote: > > I think others have already expanded on why it's not possible to group > operators in a meaningful way. The DateTime example is probably the most > pertinent there, in that DateTime + DateTime is illegal, while DateTime - > DateTime is legal. I

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

2020-03-02 Thread Nikita Popov
On Thu, Feb 27, 2020 at 9:43 PM wrote: > On 15/02/2020 22:05, jan.h.boeh...@gmx.de wrote: > > Hi internals, > > > > based on the discussions here (https://externals.io/message/108300) and > here > > (https://github.com/php/php-src/pull/5156), I have created a proper RFC > for > > userspace operat