Re: [PHP-DEV] [RFC] Comparable

2017-02-01 Thread Fleshgrinder
On 2/1/2017 2:44 PM, Rowan Collins wrote: > On 31 January 2017 23:02:07 GMT+00:00, Ryan Pallas > wrote: >> I would say compareTo makes sense, because that's what you're >> asking the method to do. Methods aren't usually past tense as it >> would seem weird. > > To be specific, methods are general

Re: [PHP-DEV] [RFC] Comparable

2017-02-01 Thread Rowan Collins
On 31 January 2017 23:02:07 GMT+00:00, Ryan Pallas wrote: >I would say compareTo makes sense, because that's what you're asking >the >method to do. Methods aren't usually past tense as it would seem weird. To be specific, methods are generally named as "imperative" phrases, because they are inst

Re: [PHP-DEV] [RFC] Comparable

2017-01-31 Thread Ryan Pallas
On Tue, Jan 31, 2017 at 3:48 PM, Fleshgrinder wrote: > Hi :) > > I have a few questions regarding the comparable RFC: > > https://wiki.php.net/rfc/comparable > > Couldn't find the thread in my history and thus cannot respond directly > to any of the past threads. Maybe not that bad after more tha

[PHP-DEV] [RFC] Comparable

2017-01-31 Thread Fleshgrinder
Hi :) I have a few questions regarding the comparable RFC: https://wiki.php.net/rfc/comparable Couldn't find the thread in my history and thus cannot respond directly to any of the past threads. Maybe not that bad after more than a year of silence. :) My question might sound silly but I am genu

Re: [PHP-DEV] [RFC] Comparable: the revenge

2015-02-20 Thread Nikita Popov
On Thu, Feb 19, 2015 at 10:40 PM, Adam Harvey wrote: > Hi all, > > Those of you with long memories will remember that I proposed a > Comparable interface way back in the pre-5.4 days, but withdrew it > when it became obvious that there was no consensus for it as a feature > and that a vote was li

Re: [PHP-DEV] [RFC] Comparable: the revenge

2015-02-20 Thread Markus Fischer
On 19.02.15 22:40, Adam Harvey wrote: > Those of you with long memories will remember that I proposed a > Comparable interface way back in the pre-5.4 days, but withdrew it > when it became obvious that there was no consensus for it as a feature > and that a vote was likely to fail. > > RFC: https

Re: [PHP-DEV] [RFC] Comparable: the revenge

2015-02-20 Thread Dennis Birkholz
Hi Adam, Am 19.02.2015 um 22:40 schrieb Adam Harvey: > RFC: https://wiki.php.net/rfc/comparable > PR: https://github.com/php/php-src/pull/1097 I see a little problem here by allowing any comparison. Comparing is used for ordering, but you can easily construct ordering mechanisms that simply don't

Re: [PHP-DEV] [RFC] Comparable: the revenge

2015-02-19 Thread Pierre Joye
On Thu, Feb 19, 2015 at 1:40 PM, Adam Harvey wrote: > Hi all, > > Those of you with long memories will remember that I proposed a > Comparable interface way back in the pre-5.4 days, but withdrew it > when it became obvious that there was no consensus for it as a feature > and that a vote was like

Re: [PHP-DEV] [RFC] Comparable: the revenge

2015-02-19 Thread Levi Morrison
>> But even here I would rather just take a function instead of requiring >> it to be the instance of some interface: >> >> function sort($input, callable $comparator($a, $b): int) { >> /* … */ >> } > > Fair, but the sorting case isn't the only one that matters, > particularly with <=> now as p

Re: [PHP-DEV] [RFC] Comparable: the revenge

2015-02-19 Thread Adam Harvey
I don't want to get into a lengthy debate (you have your opinion; I have mine!), but to rebut a couple of specific points: On 19 February 2015 at 14:19, Levi Morrison wrote: > Another issue: it allows comparing an object to non-objects (even > though the stated goal is only to compare two objects

Re: [PHP-DEV] [RFC] Comparable: the revenge

2015-02-19 Thread Levi Morrison
> Those of you with long memories will remember that I proposed a > Comparable interface way back in the pre-5.4 days, but withdrew it > when it became obvious that there was no consensus for it as a feature > and that a vote was likely to fail. > > RFC: https://wiki.php.net/rfc/comparable > PR: ht

[PHP-DEV] [RFC] Comparable: the revenge

2015-02-19 Thread Adam Harvey
Hi all, Those of you with long memories will remember that I proposed a Comparable interface way back in the pre-5.4 days, but withdrew it when it became obvious that there was no consensus for it as a feature and that a vote was likely to fail. RFC: https://wiki.php.net/rfc/comparable PR: https:

Re: [PHP-DEV] RFC: Comparable interface

2010-10-06 Thread Gustavo Lopes
On Wed, 06 Oct 2010 16:32:40 +0100, Richard Lynch wrote: On Tue, October 5, 2010 5:44 am, Gustavo Lopes wrote: On Tue, 05 Oct 2010 04:31:14 +0100, Richard Lynch wrote: On Sun, October 3, 2010 12:34 pm, Gustavo Lopes wrote: * The current behavior for >, <, etc. is completely useless. It's u

Re: [PHP-DEV] RFC: Comparable interface

2010-10-06 Thread Richard Lynch
On Tue, October 5, 2010 5:44 am, Gustavo Lopes wrote: > On Tue, 05 Oct 2010 04:31:14 +0100, Richard Lynch > wrote: > >> On Sun, October 3, 2010 12:34 pm, Gustavo Lopes wrote: >>> * The current behavior for >, <, etc. is completely useless. It's >>> unpredictable and it doesn't even establish a tot

Re: [PHP-DEV] RFC: Comparable interface

2010-10-05 Thread Gustavo Lopes
On Tue, 05 Oct 2010 04:31:14 +0100, Richard Lynch wrote: On Sun, October 3, 2010 12:34 pm, Gustavo Lopes wrote: * The current behavior for >, <, etc. is completely useless. It's unpredictable and it doesn't even establish a total order: $a = new stdclass; $a->prop = null; $b = new stdclass; $

Re: [PHP-DEV] RFC: Comparable interface

2010-10-04 Thread Richard Lynch
On Sun, October 3, 2010 6:18 pm, Stas Malyshev wrote: >> $a = new stdclass; >> $a->prop = null; >> $b = new stdclass; >> $b->prop2 = null; >> >> var_dump($a> $b); //false >> var_dump($a == $b); //false >> var_dump($b> $a); //false > > That's because there's no total ordering of generic objects th

Re: [PHP-DEV] RFC: Comparable interface

2010-10-04 Thread Richard Lynch
On Sun, October 3, 2010 12:34 pm, Gustavo Lopes wrote: > * The current behavior for >, <, etc. is completely useless. It's > unpredictable and it doesn't even establish a total order: > > $a = new stdclass; > $a->prop = null; > $b = new stdclass; > $b->prop2 = null; > > var_dump($a > $b); //false >

Re: [PHP-DEV] RFC: Comparable interface

2010-10-03 Thread Gustavo Lopes
On Mon, 04 Oct 2010 00:18:36 +0100, Stas Malyshev wrote: * The current behavior for>,<, etc. is completely useless. It's unpredictable and it doesn't even establish a total order: $a = new stdclass; $a->prop = null; $b = new stdclass; $b->prop2 = null; var_dump($a> $b); //false var_dump($a

Re: [PHP-DEV] RFC: Comparable interface

2010-10-03 Thread Stas Malyshev
Hi! * The current behavior for>,<, etc. is completely useless. It's unpredictable and it doesn't even establish a total order: $a = new stdclass; $a->prop = null; $b = new stdclass; $b->prop2 = null; var_dump($a> $b); //false var_dump($a == $b); //false var_dump($b> $a); //false That's bec

Re: [PHP-DEV] RFC: Comparable interface

2010-10-03 Thread Pierre Joye
hi Gustavo, On Sun, Oct 3, 2010 at 7:34 PM, Gustavo Lopes wrote: > You raise a fair point -- the motivation to override the comparison operator > for internal classes is indeed bigger because the state is not in the usual > places. However: > > * The functionality already exists; comparison oper

Re: [PHP-DEV] RFC: Comparable interface

2010-10-03 Thread Gustavo Lopes
On Sun, 03 Oct 2010 15:37:41 +0100, Johannes Schlüter wrote: On Sun, 2010-10-03 at 15:21 +0100, Gustavo Lopes wrote: I actually see no reason why we shouldn't expose the compare overload we already have for internal classes to userspace classes. For internal classes it is needed, as they

Re: [PHP-DEV] RFC: Comparable interface

2010-10-03 Thread Johannes Schlüter
On Sun, 2010-10-03 at 15:21 +0100, Gustavo Lopes wrote: > On Sun, 03 Oct 2010 15:16:05 +0100, Johannes Schlüter > wrote: > > > On Thu, 2010-09-30 at 22:57 +0800, Adam Harvey wrote: > >> > On Thu, 30 Sep 2010, Johannes Schlüter wrote: > >> >> What is this "more interesting stuff to come"? > >> >

Re: [PHP-DEV] RFC: Comparable interface

2010-10-03 Thread Gustavo Lopes
On Sun, 03 Oct 2010 15:16:05 +0100, Johannes Schlüter wrote: On Thu, 2010-09-30 at 22:57 +0800, Adam Harvey wrote: > On Thu, 30 Sep 2010, Johannes Schlüter wrote: >> What is this "more interesting stuff to come"? Nothing that's likely to be ready before the forthcoming release cycle. I real

Re: [PHP-DEV] RFC: Comparable interface

2010-10-03 Thread Johannes Schlüter
On Thu, 2010-09-30 at 22:57 +0800, Adam Harvey wrote: > > On Thu, 30 Sep 2010, Johannes Schlüter wrote: > >> What is this "more interesting stuff to come"? > > Nothing that's likely to be ready before the forthcoming release > cycle. I really did just want the RFC writing practice, since I > haven

Re: [PHP-DEV] RFC: Comparable interface

2010-10-03 Thread Richard Lynch
On Thu, September 30, 2010 8:33 am, Adam Harvey wrote: > If there's no great resistance to the concept or implementation, I'm > happy enough to flip this into the voting stage sooner rather than > later so we can get it out of the way. If I'm understanding this correctly, you're going to make it W

Re: [PHP-DEV] RFC: Comparable interface

2010-09-30 Thread Adam Harvey
For what it's worth, I'm planning to update the RFC later today with an updated SPL-less patch and the start of a Q&A section similar to what we've had in the other RFCs. I'll send an e-mail when it's ready. On 1 October 2010 04:28, Stas Malyshev wrote: > It is not clear from the RFC, if the engi

Re: [PHP-DEV] RFC: Comparable interface

2010-09-30 Thread Stas Malyshev
Hi! The RFC is at http://wiki.php.net/rfc/comparable, and the patch at http://www.adamharvey.name/patches/comparable.diff.txt. Any and all feedback welcome, particularly since I'm still learning my way around the innards of the Zend Engine, and it's entirely possible (indeed, likely) that I've o

Re: [PHP-DEV] RFC: Comparable interface

2010-09-30 Thread Gustavo Lopes
On Thu, 30 Sep 2010 16:25:28 +0100, Adam Harvey wrote: The initial version of the patch actually did just that: it simply modified zend_std_compare_objects. That's pretty much the cleanest way you could do it. :) (...) Additionally, there are already semantics built into compare_function to ha

Re: [PHP-DEV] RFC: Comparable interface

2010-09-30 Thread Adam Harvey
On 30 September 2010 23:13, Gustavo Lopes wrote: > That is, you would only modify zend_std_compare_objects (not > compare_function!) and add there the additional logic where you'd check if > the objects had the same class (or perhaps one was of a subclass of the > other, in which case you'd use th

Re: [PHP-DEV] RFC: Comparable interface

2010-09-30 Thread Gustavo Lopes
On Thu, 30 Sep 2010 14:33:05 +0100, Adam Harvey wrote: I've just written an RFC (with a patch against trunk) to implement a Comparable interface similar to that in Java — in effect, allowing object instances to be compared with semantics defined in userspace. This is admittedly at the lower end

Re: [PHP-DEV] RFC: Comparable interface

2010-09-30 Thread Adam Harvey
(Omnibus reply, since Johannes's original e-mail hasn't yet dropped into my ever-so-flaky mail setup. I have read it in full on news.php.net, though.) > On Thu, 30 Sep 2010, Johannes Schlüter wrote: >> What is this "more interesting stuff to come"? Nothing that's likely to be ready before the for

Re: [PHP-DEV] RFC: Comparable interface

2010-09-30 Thread Adam Harvey
2010/9/30 Johannes Schlüter : > On Thu, 2010-09-30 at 16:08 +0200, Kalle Sommer Nielsen wrote: >> I think its a great addition, but I think the interface should be >> defined within ZE like the other base interfaces that interact >> directly with the language syntax (like Iterator) and not in SPL.

Re: [PHP-DEV] RFC: Comparable interface

2010-09-30 Thread Derick Rethans
On Thu, 30 Sep 2010, Johannes Schlüter wrote: > On Thu, 2010-09-30 at 21:33 +0800, Adam Harvey wrote: > > All, > > > > I've just written an RFC (with a patch against trunk) to implement a > > Comparable interface similar to that in Java — in effect, allowing > > object instances to be compared wi

Re: [PHP-DEV] RFC: Comparable interface

2010-09-30 Thread Gustavo Lopes
On Thu, 30 Sep 2010 15:26:17 +0100, Johannes Schlüter wrote: On Thu, 2010-09-30 at 16:08 +0200, Kalle Sommer Nielsen wrote: I think its a great addition, but I think the interface should be defined within ZE like the other base interfaces that interact directly with the language syntax (like

Re: [PHP-DEV] RFC: Comparable interface

2010-09-30 Thread Johannes Schlüter
On Thu, 2010-09-30 at 16:08 +0200, Kalle Sommer Nielsen wrote: > I think its a great addition, but I think the interface should be > defined within ZE like the other base interfaces that interact > directly with the language syntax (like Iterator) and not in SPL. s/should/has to/ The engine shall

Re: [PHP-DEV] RFC: Comparable interface

2010-09-30 Thread Johannes Schlüter
On Thu, 2010-09-30 at 21:33 +0800, Adam Harvey wrote: > All, > > I've just written an RFC (with a patch against trunk) to implement a > Comparable interface similar to that in Java — in effect, allowing > object instances to be compared with semantics defined in userspace. > This is admittedly at

Re: [PHP-DEV] RFC: Comparable interface

2010-09-30 Thread Kalle Sommer Nielsen
Hi Adam 2010/9/30 Adam Harvey : > All, > > I've just written an RFC (with a patch against trunk) to implement a > Comparable interface similar to that in Java — in effect, allowing > object instances to be compared with semantics defined in userspace. > This is admittedly at the lower end of RFC-w

[PHP-DEV] RFC: Comparable interface

2010-09-30 Thread Adam Harvey
All, I've just written an RFC (with a patch against trunk) to implement a Comparable interface similar to that in Java — in effect, allowing object instances to be compared with semantics defined in userspace. This is admittedly at the lower end of RFC-worthy proposals, but it's a good system, and