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

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

2020-03-02 Thread Terje Slettebø
On 15/02/2020 22:05, jan.h.boeh...@gmx.de wrote: How many of you would prefer a interface solution for operator overloading? I wonder if the RFC voting should include the option to choose between either the magic method approach (with the syntax proposed in the current RFC version) or using inter

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

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

2020-03-01 Thread Andrea Faulds
Hi Jan, jan.h.boeh...@gmx.de wrote: On 15/02/2020 22:05, jan.h.boeh...@gmx.de wrote: How many of you would prefer a interface solution for operator overloading? I wonder if the RFC voting should include the option to choose between either the magic method approach (with the syntax proposed in th

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

2020-02-27 Thread jan.h.boehmer
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 operator overloading: > https://wiki.php.net/rfc/userspace_ope

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

2020-02-22 Thread Terje Slettebø
jan.h.boeh...@gmx.de wrote: 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 operator overloading: https://wiki.php.net/rfc/userspace_operator_overloading The main differences to my

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

2020-02-16 Thread jan.h.boehmer
On 16/02/2020 01:17, marand...@php.net wrote: > N :( Notices are the enemy of all that is great and good. > > If operator overloading is going to become a first-class feature then it > should be treated as such, and attempting overloading operators on > objects that don't have the relevant m

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

2020-02-15 Thread Mark Randall
On 15/02/2020 22:05, jan.h.boeh...@gmx.de wrote: Hi internals, What do you think about the RFC? "If an operator is used with an object that does not overload this operator, an NOTICE is triggered, which gives the user a hint about the method that has to be overloaded. For backward compatibili