[PHP-DEV] Re: RFC Operator Overloading in Userspace

2016-02-01 Thread Andrea Faulds
Hi Stephen, Stephen Coakley wrote: It looks like I'm late to the party for this discussion, but I feel like this is a similar concept to the already existing Comparable RFC , which in my opinion, has a much better interface. Is this slightly more in-line with what you're thinking with type clas

[PHP-DEV] Re: RFC Operator Overloading in Userspace

2016-02-01 Thread Stephen Coakley
On Mon, 04 Jan 2016 16:34:21 +, Andrea Faulds wrote: > Hi Sara, > > Sara Golemon wrote: >> Patricio Tarantino has asked me to help him propose Operator >> Overloading in PHP 7.1 (based in part on my operator extension in >> PECL). I think we can expose this to usespace as magic methods with

Re: [PHP-DEV] Re: RFC Operator Overloading in Userspace

2016-01-05 Thread Stanislav Malyshev
Hi! > Interface is a good way to implement new functionality for classes, but > operator overloading is language feature itself, so from my point of view, > it will be better to put this functionality into the magic method. No contradiction here. Language features can use interfaces, see Throwabl

Re: [PHP-DEV] Re: RFC Operator Overloading in Userspace

2016-01-05 Thread Alexander Lisachenko
2016-01-05 2:04 GMT+03:00 Andrea Faulds : > I agree that we could do something with interfaces. I would like to point > out that we actually already have an example of this, in the form of the > \ArrayAccess interface, which requires you to implement all the different > indexing operations at once

Re: [PHP-DEV] Re: RFC Operator Overloading in Userspace

2016-01-04 Thread Larry Garfield
On 01/04/2016 05:04 PM, Andrea Faulds wrote: I agree that we could do something with interfaces. I would like to point out that we actually already have an example of this, in the form of the \ArrayAccess interface, which requires you to implement all the different indexing operations at once.

Re: [PHP-DEV] Re: RFC Operator Overloading in Userspace

2016-01-04 Thread Andrea Faulds
Hi Stas, Stanislav Malyshev wrote: Hi! constraint on function parameters and return types. I think it would be more worth pursuing a Haskell-style approach in PHP, most likely with a hierarchy of magic interfaces. I agree that interface approach looks better than Python/C++ approach for PHP.

Re: [PHP-DEV] Re: RFC Operator Overloading in Userspace

2016-01-04 Thread Stanislav Malyshev
Hi! > constraint on function parameters and return types. I think it would be > more worth pursuing a Haskell-style approach in PHP, most likely with a > hierarchy of magic interfaces. I agree that interface approach looks better than Python/C++ approach for PHP. One thing it also allows is intro

Re: [PHP-DEV] Re: RFC Operator Overloading in Userspace

2016-01-04 Thread Andrea Faulds
Hi Rowan, Rowan Collins wrote: On 04/01/2016 16:34, Andrea Faulds wrote: In Haskell, a purely-functional programming language, certain operators (and also certain math functions like abs()) are defined as part of "typeclasses", somewhat akin to interfaces in classical object-oriented languages

Re: [PHP-DEV] Re: RFC Operator Overloading in Userspace

2016-01-04 Thread Rowan Collins
On 04/01/2016 16:34, Andrea Faulds wrote: In Haskell, a purely-functional programming language, certain operators (and also certain math functions like abs()) are defined as part of "typeclasses", somewhat akin to interfaces in classical object-oriented languages like Java or PHP. These typecla

[PHP-DEV] Re: RFC Operator Overloading in Userspace

2016-01-04 Thread Andrea Faulds
Hi Sara, Sara Golemon wrote: Patricio Tarantino has asked me to help him propose Operator Overloading in PHP 7.1 (based in part on my operator extension in PECL). I think we can expose this to usespace as magic methods with very little overhead (the runtime check and dispatch is already there,