[squeak-dev] Could a Point behave like a Magnitude? :)

marcel.taeumel Marcel.Taeumel at hpi.de
Fri Aug 19 08:44:18 UTC 2016


Hi, there.

Right now, this is can happen when comparing two points:

(100 at 50) < (100 at 60). "false"
(100 at 50) > (100 at 60). "false"
(100 at 50) = (100 at 60). "false"

This is because one component is the same and implementation in Point is
like this:

< anotherPoint
   ^x < aPoint x and: [y < aPoint y]

Hence, points do not have like magnitudes. For the aformentioned examples, a
"fix" could be:

< anotherPoint
   ^(self >= anotherPoint) not

Now, the interesting thing is that event handling (mouse clicks etc.)
becomes awkward after that. :-D

Best,
Marcel






--
View this message in context: http://forum.world.st/Could-a-Point-behave-like-a-Magnitude-tp4911882.html
Sent from the Squeak - Dev mailing list archive at Nabble.com.


More information about the Squeak-dev mailing list