Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
If we undef <=>, it solves a problem involving comparison. Please fig…
…ure out the root cause.
- Loading branch information
0042f41
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can confirm that this "fixes" #4772: http://github.com/rails/rails/commit/0042f4166f783085eb909d69d542b5323d8af5d6 but it would be nice to have a better understanding of why it fixes it.
0042f41
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doh, this "undef" broke my tests... the "<=>" method doesn't exist, so it can't undef it. (I'm on edge, ruby 1.9.1p378 (2010-01-10 revision 26273)).
It looks like "<=>" is defined further down the file, so maybe the undef is too called too early?
0042f41
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to my tests (ruby 1.9.1p378 and rails beta 4), <=> doesn't exist, so the undef throws an error. Same problem as deanmao
0042f41
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem is, imho, caused because of the way compar.c calls the spaceship:
The current implementation of the spaceship operator ...
... tries to lookup the method in the parent classes but fails because it's
actually implemented in the Kernel module:
But I'm neither familiar with C nor the ruby source so this is just a guess.
0042f41
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this actually seems to break functionality though, even if its allowing tests to pass. I start seeing an error because of this change: http://gist.github.com/431583
0042f41
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wait, so reading more from lighthouse and here again, is this a 1.9.2 fix?
0042f41
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a problem to simply delegate it?
0042f41
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@boof well, the actual implementation is pretty much what you wrote, around line 102, but it only gets included if RUBY_VERSION < "1.9"
0042f41
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yepp, just delegating the method to the wrapped object should work around the buggy core implementation of Kernel#<=>.