Alexandre,
I can't tell why exactly, but this kind of discussion seems /déjà vu/ for me. .
. I agree I cannot find the specific thread about it.
OTOH, it brings an opportunity to solve the issue 'fixing' it where it belongs:
containsPoint: aPoint
"Answer whether aPoint is within the receiver."
^origin <= aPoint and: [aPoint < corner]
The method in question is implemented using an overloading of the #<= on Point.
I don't think points could be considered comparable. . .
Anyway the operator is 'overloaded' and the method comment is clearly showing
the intent of the implementation:
<= aPoint
"Answer whether the receiver is neither below nor to the right of
aPoint."
^x <= aPoint x and: [y <= aPoint y]
About the impacts you see, I didn't have time to do a thorough research. Why
doing (No attempt to optimize, just to put the perspective):
containsPoint: aPoint
"Answer whether aPoint is within the receiver."
^(origin <= aPoint and: [aPoint < corner]) or: [corner <= aPoint and:
[aPoint < origin]]
Has impacts in present Pharo code?
--
Cesar Rabak
Em 22/04/2010 16:55, Alexandre Bergel < [email protected] > escreveu:
Dear List,
I spend quite some time in tracking down a bug in Mondrian. I found
it. The source of it stems from the following behavior in Pharo:
-=-=-=-=-=-=
(0...@0 corner: 1...@10) containsPoint: 5...@5. => true
(1...@10 corner: 0...@0) containsPoint: 5...@5. => false
-=-=-=-=-=-=
I find the latter a bit surprising. VW returns false as well. I would
expect the second expression to return true.
There is also "(1...@0 corner: 0...@10) containsPoint: 5...@5. => false"
I looked in the Pharo mailing list archive, and apparently this hasn't
been discussed yet.
The class Rectangle is central. Modifying it (either by making "(1...@10
corner: 0...@0) containsPoint: 5...@5" returns true or not permitting a
rectangle "(1...@10 corner: 0...@0)" to be valid) may have some serious
impact.
What do you think?
Cheers,
Alexandre
--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
_______________________________________________
Pharo-project mailing list
[email protected]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
_______________________________________________
Pharo-project mailing list
[email protected]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project