Skip to content

Conversation

@hikari-no-yume
Copy link
Contributor Author

ext/tokenizer data would need regenerating, but the shell script is completely broken on my machine so someone else would need to do it. I thought I needed GNU awk, but that didn't fix it.

@smalyshev smalyshev added the RFC label Jan 19, 2015
@hikari-no-yume
Copy link
Contributor Author

Huh, I had no idea there was prior art RFC-wise. Maybe @dshafik would let me take over that RFC.

I like his token name: T_ENTERPRISE.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be nice to add some objects - like GMP - here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair point. This is based on the > test, so the others should be updated if that's the case.

@hikari-no-yume hikari-no-yume force-pushed the spaceship_operator branch 4 times, most recently from c2b0fe1 to d8f2d82 Compare January 19, 2015 07:47
@laruence
Copy link
Member

@TazeTSchnitzel okey. you are right... I am in a insane status now.

@r3wt
Copy link

r3wt commented Jan 19, 2015

what point would this even serve? lol

@hikari-no-yume
Copy link
Contributor Author

@r3wt It makes it easier to write comparison functions used in sorting, for example.

@Ragazzo
Copy link

Ragazzo commented Jan 19, 2015

@TazeTSchnitzel great , it is really useful, especially when building neural networks

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Andrea! Why not use (!$failed) or $failed === false? Strict comparisons are nicer if possible. Thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, it's like that because this is based on either the >= or the <= test (can't remember). It wasn't a deliberate choice on my part.

I could fix it, but I don't see the point, especially as it'd just make this inconsistent with the other tests.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I guess those tests date back to a time when strict comparisons where not that popular! And thanks for the hard work :)

@vstinner
Copy link

vstinner commented Feb 4, 2015

Hi,

Sorry, I don't know if it's the best place to comment the RFC https://wiki.php.net/rfc/combined-comparison-operator

I'm surprised by PHP adds <=> operator in PHP 7, while Python 3 dropped cmp(). cmp() was dropped because it had many issues. Example:
https://stackoverflow.com/questions/20202418/why-is-the-cmp-parameter-removed-from-sort-sorted-in-python3-0

@hikari-no-yume
Copy link
Contributor Author

@Haypo from what I can see, Python's removal of __cmp__ has no relevance to PHP.

@vstinner
Copy link

vstinner commented Feb 4, 2015

@Haypo from what I can see, Python's removal of cmp has no relevance to PHP.

PHP has also objects which have surprising behaviour on comparison. For example, float not a number (NaN). Try with "$nan = acos(8);".

$ php -a Interactive shell php > $a=acos(8); php > $b=acos(10); php > var_dump($a); float(NAN) php > var_dump($b); float(NAN) php > var_dump($a > $b); bool(false) php > var_dump($a >= $b); bool(false) php > var_dump($a < $b); bool(false) php > var_dump($a <= $b); bool(false) php > var_dump($a == $b); bool(false) php > var_dump($a != $b); bool(true) 

What should be the result of $a <=> $b for NaN?

See also:

@hikari-no-yume
Copy link
Contributor Author

Those aren't objects.

@hikari-no-yume
Copy link
Contributor Author

@smalyshev I just rebased the branch onto master and squashed the commits, FYI. (This pull request is dead, though.)

@Ragazzo
Copy link

Ragazzo commented Feb 17, 2015

@TazeTSchnitzel why is it closed and dead is you said , it is a great feature ?

@hikari-no-yume
Copy link
Contributor Author

@Ragazzo I quit PHP development. However, @smalyshev revived it, and it passed.

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling d8b7a44 on TazeTSchnitzel:spaceship_operator into * on php:master*.

@hikari-no-yume
Copy link
Contributor Author

why is @coveralls bothering me about this. the pull request is closed.

@dshafik
Copy link
Contributor

dshafik commented Aug 12, 2016

@TazeTSchnitzel asking the right questions. I got the email too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

9 participants