Hi list,
I was doing some test cases and I bumped into this behavior: 2 >= (2@3) is true, but: (2@2) >= (2@3) and (2@3) <= 2 are both false. The thing is that by combining automatic coercion with the way comparison is implemented in magnitude (i.e. assuming that ">= aMagnitude" means "(self < aMagnitude) not") the first case ends in (2@2) < (2@3), which is false, and thus >= returns true. On the other hand, the second cases are implemented in Point, comparing the coordinates of 2@3 against 2, which yields (what seems to me) the correct result. So I was wondering if this is the intended behavior or maybe I'm missing something. -- Thanks in advance, Andrés _______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc |
In my opinion, we should have these two things.
a) consistent behavior, b) reasonable behavior. At least at first sight, I do not think that comparing numbers with points falls in the "reasonable" category, and so I'd tend to break comparison between numbers and points on purpose so that such an operation raises an "IncomparableQuantities" exception or something of that nature --- thus achieving the "consistent" part. Does anybody know a good use of comparison between points and numbers? Andres. -----Original Message----- From: [hidden email] [mailto:[hidden email]] On Behalf Of andres Sent: Monday, December 29, 2008 12:21 PM To: VWNC List Subject: [vwnc] Question about coercion and the Magnitude hierarchy Hi list, I was doing some test cases and I bumped into this behavior: 2 >= (2@3) is true, but: (2@2) >= (2@3) and (2@3) <= 2 are both false. The thing is that by combining automatic coercion with the way comparison is implemented in magnitude (i.e. assuming that ">= aMagnitude" means "(self < aMagnitude) not") the first case ends in (2@2) < (2@3), which is false, and thus >= returns true. On the other hand, the second cases are implemented in Point, comparing the coordinates of 2@3 against 2, which yields (what seems to me) the correct result. So I was wondering if this is the intended behavior or maybe I'm missing something. -- Thanks in advance, Andrés _______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc _______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc |
In reply to this post by Andres Fortier-2
IMHO, comparing points with numbers falls to same category of operations as comparing Complex numbers with Floats. Don't see reasonable application unless conversion rules between Numbers and Points are defined (even locally relevant).
However, comparison methods within 7.6 image defined for Points are comparing such that Point is bigger (in terms of > relation ship) if both coordinates are numerically bigger. A number is coerced into Point by using x -> x @ x which is little bit weird for me (don't see logical sense of this conversion). With respect to this definition, expression 2 >= 2@3 should definitely return false. Even if the comparison operation is illogical for me, it should behave consistently with conversion definition used by Point and Number. Petr -----Original Message----- From: [hidden email] [mailto:[hidden email]] On Behalf Of Valloud, Andres Sent: 30. prosince 2008 17:50 To: [hidden email] Subject: Re: [vwnc] Question about coercion and the Magnitude hierarchy In my opinion, we should have these two things. a) consistent behavior, b) reasonable behavior. At least at first sight, I do not think that comparing numbers with points falls in the "reasonable" category, and so I'd tend to break comparison between numbers and points on purpose so that such an operation raises an "IncomparableQuantities" exception or something of that nature --- thus achieving the "consistent" part. Does anybody know a good use of comparison between points and numbers? Andres. -----Original Message----- From: [hidden email] [mailto:[hidden email]] On Behalf Of andres Sent: Monday, December 29, 2008 12:21 PM To: VWNC List Subject: [vwnc] Question about coercion and the Magnitude hierarchy Hi list, I was doing some test cases and I bumped into this behavior: 2 >= (2@3) is true, but: (2@2) >= (2@3) and (2@3) <= 2 are both false. The thing is that by combining automatic coercion with the way comparison is implemented in magnitude (i.e. assuming that ">= aMagnitude" means "(self < aMagnitude) not") the first case ends in (2@2) < (2@3), which is false, and thus >= returns true. On the other hand, the second cases are implemented in Point, comparing the coordinates of 2@3 against 2, which yields (what seems to me) the correct result. So I was wondering if this is the intended behavior or maybe I'm missing something. -- Thanks in advance, Andrés _______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc _______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc _______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc |
In reply to this post by Andres Valloud-6
Andres
Comparing a number to a point is actually "2 asPoint >= (2@3)" But the real problem is; For numbers "a >= b" is the same as "(a < b) not" but that does not hold for points. "(2 @ 2) >= (2 @ 3)" evaluates to false. "((2 @ 2) < (2 @ 3)) not" evaluates to true Terry =========================================================== Terry Raymond Crafted Smalltalk 80 Lazywood Ln. Tiverton, RI 02878 (401) 624-4517 [hidden email] <http://www.craftedsmalltalk.com> =========================================================== > -----Original Message----- > From: [hidden email] [mailto:[hidden email]] On Behalf Of Valloud, Andres > Sent: Tuesday, December 30, 2008 11:50 AM > To: [hidden email] > Subject: Re: [vwnc] Question about coercion and the Magnitude hierarchy > > In my opinion, we should have these two things. > > a) consistent behavior, > > b) reasonable behavior. > > At least at first sight, I do not think that comparing numbers with points falls in the "reasonable" > category, and so I'd tend to break comparison between numbers and points on purpose so that such an > operation raises an "IncomparableQuantities" exception or something of that nature --- thus achieving > the "consistent" part. > > Does anybody know a good use of comparison between points and numbers? > > Andres. > > -----Original Message----- > From: [hidden email] [mailto:[hidden email]] On Behalf Of andres > Sent: Monday, December 29, 2008 12:21 PM > To: VWNC List > Subject: [vwnc] Question about coercion and the Magnitude hierarchy > > Hi list, > I was doing some test cases and I bumped into this behavior: > > 2 >= (2@3) > > is true, but: > > (2@2) >= (2@3) > and > (2@3) <= 2 > > are both false. > > The thing is that by combining automatic coercion with the way comparison is implemented in magnitude > (i.e. assuming that ">= aMagnitude" means "(self < aMagnitude) not") the first case ends in > (2@2) < (2@3), which is false, and thus >= returns true. On the other hand, the second cases are > implemented in Point, comparing the coordinates of 2@3 against 2, which yields (what seems to me) the > correct result. So I was wondering if this is the intended behavior or maybe I'm missing something. > > -- > Thanks in advance, > Andrés > _______________________________________________ > vwnc mailing list > [hidden email] > http://lists.cs.uiuc.edu/mailman/listinfo/vwnc > > _______________________________________________ > vwnc mailing list > [hidden email] > http://lists.cs.uiuc.edu/mailman/listinfo/vwnc _______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc |
Perhaps I am blind to the obvious, but what is the point (no pun intended) of doing this?
2 >= (2@3) What is the use case for the current implementation of point comparison? Also... Statement: Comparison between points is an order relation. Order relations are irreflexive, asymmetric and transitive, and so we have to prove that Point>>< satisfies these properties. The current implementation of Point>>< is clearly irreflexive because no point p can satisfy p < p. It is also asymmetric, because if p < q, then without loss of generality we must have that p x < q x. Then q x < p x will be false, and therefore q < p will not be satisfied. Similar arguments show that this method is also transitive. Consider that p < q and q < r. From this we conclude that p x < q x < r x and p y < q y < r y. Dropping the middle terms from these inequalities we see that p x < r x and p y < r y, and therefore p < r. So, after all, the current implementation makes (some) sense. See http://en.wikipedia.org/wiki/Strict_weak_ordering. Andres. -----Original Message----- From: Terry Raymond [mailto:[hidden email]] Sent: Tuesday, December 30, 2008 10:01 AM To: Valloud, Andres; [hidden email] Subject: RE: [vwnc] Question about coercion and the Magnitude hierarchy Andres Comparing a number to a point is actually "2 asPoint >= (2@3)" But the real problem is; For numbers "a >= b" is the same as "(a < b) not" but that does not hold for points. "(2 @ 2) >= (2 @ 3)" evaluates to false. "((2 @ 2) < (2 @ 3)) not" evaluates to true Terry =========================================================== Terry Raymond Crafted Smalltalk 80 Lazywood Ln. Tiverton, RI 02878 (401) 624-4517 [hidden email] <http://www.craftedsmalltalk.com> =========================================================== > -----Original Message----- > From: [hidden email] [mailto:[hidden email]] On > Behalf Of Valloud, Andres > Sent: Tuesday, December 30, 2008 11:50 AM > To: [hidden email] > Subject: Re: [vwnc] Question about coercion and the Magnitude > hierarchy > > In my opinion, we should have these two things. > > a) consistent behavior, > > b) reasonable behavior. > > At least at first sight, I do not think that comparing numbers with points falls in the "reasonable" > category, and so I'd tend to break comparison between numbers and > points on purpose so that such an operation raises an > "IncomparableQuantities" exception or something of that nature --- thus achieving the "consistent" part. > > Does anybody know a good use of comparison between points and numbers? > > Andres. > > -----Original Message----- > From: [hidden email] [mailto:[hidden email]] On > Behalf Of andres > Sent: Monday, December 29, 2008 12:21 PM > To: VWNC List > Subject: [vwnc] Question about coercion and the Magnitude hierarchy > > Hi list, > I was doing some test cases and I bumped into this behavior: > > 2 >= (2@3) > > is true, but: > > (2@2) >= (2@3) > and > (2@3) <= 2 > > are both false. > > The thing is that by combining automatic coercion with the way > comparison is implemented in magnitude (i.e. assuming that ">= > aMagnitude" means "(self < aMagnitude) not") the first case ends in > (2@2) < (2@3), which is false, and thus >= returns true. On the other > hand, the second cases are implemented in Point, comparing the > coordinates of 2@3 against 2, which yields (what seems to me) the correct result. So I was wondering if this is the intended behavior or maybe I'm missing something. > > -- > Thanks in advance, > Andrés > _______________________________________________ > vwnc mailing list > [hidden email] > http://lists.cs.uiuc.edu/mailman/listinfo/vwnc > > _______________________________________________ > vwnc mailing list > [hidden email] > http://lists.cs.uiuc.edu/mailman/listinfo/vwnc _______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc |
In reply to this post by Terry Raymond
> Comparing a number to a point is actually "2 asPoint >= (2@3)"
I guess that is the way it should be, however is valid to do "2 >= (2@3)", which is what puzzles me. Maybe an exception of "Not Matching Magnitudes" (or something like that) should be thrown. > But the real problem is; > > For numbers "a >= b" is the same as "(a < b) not" but that > does not hold for points. > > "(2 @ 2) >= (2 @ 3)" evaluates to false. > > "((2 @ 2) < (2 @ 3)) not" evaluates to true Exactly, which is why I mentioned the >= was solved at he Magnitude level. The thing is that it is ok to think of numbers as magnitudes, the problem is that the comparison is not done against a magnitude (at least in the >= vs. < sense). Maybe Points aren't really magnitudes? Btw, here are other nice examples: 2 max: (1@1) "2" 2 max: (1@2) "1@2" (2@2) max: (1@2) "2@2" The first and second are really annoying to me; depending in the comparison, we get different result types :( Best regards, Andrés _______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc |
In reply to this post by Vacha Petr
Yes. Even though I may not agree on the automatic conversion from
numbers to points, I would expect: 2 >= (2@3) 2 asPoint >= (2@3) to give the same result. Best regards, Andrés Vacha Petr escribió: > IMHO, comparing points with numbers falls to same category of operations as comparing Complex numbers with Floats. Don't see reasonable application unless conversion rules between Numbers and Points are defined (even locally relevant). > > However, comparison methods within 7.6 image defined for Points are comparing such that Point is bigger (in terms of > relation ship) if both coordinates are numerically bigger. A number is coerced into Point by using x -> x @ x which is little bit weird for me (don't see logical sense of this conversion). With respect to this definition, expression 2 >= 2@3 should definitely return false. Even if the comparison operation is illogical for me, it should behave consistently with conversion definition used by Point and Number. > > Petr > > -----Original Message----- > From: [hidden email] [mailto:[hidden email]] On Behalf Of Valloud, Andres > Sent: 30. prosince 2008 17:50 > To: [hidden email] > Subject: Re: [vwnc] Question about coercion and the Magnitude hierarchy > > In my opinion, we should have these two things. > > a) consistent behavior, > > b) reasonable behavior. > > At least at first sight, I do not think that comparing numbers with points falls in the "reasonable" category, and so I'd tend to break comparison between numbers and points on purpose so that such an operation raises an "IncomparableQuantities" exception or something of that nature --- thus achieving the "consistent" part. > > Does anybody know a good use of comparison between points and numbers? > > Andres. > > -----Original Message----- > From: [hidden email] [mailto:[hidden email]] On Behalf Of andres > Sent: Monday, December 29, 2008 12:21 PM > To: VWNC List > Subject: [vwnc] Question about coercion and the Magnitude hierarchy > > Hi list, > I was doing some test cases and I bumped into this behavior: > > 2 >= (2@3) > > is true, but: > > (2@2) >= (2@3) > and > (2@3) <= 2 > > are both false. > > The thing is that by combining automatic coercion with the way comparison is implemented in magnitude (i.e. assuming that ">= aMagnitude" means "(self < aMagnitude) not") the first case ends in > (2@2) < (2@3), which is false, and thus >= returns true. On the other hand, the second cases are implemented in Point, comparing the coordinates of 2@3 against 2, which yields (what seems to me) the correct result. So I was wondering if this is the intended behavior or maybe I'm missing something. > > -- > Thanks in advance, > Andrés > _______________________________________________ > vwnc mailing list > [hidden email] > http://lists.cs.uiuc.edu/mailman/listinfo/vwnc > > _______________________________________________ > vwnc mailing list > [hidden email] > http://lists.cs.uiuc.edu/mailman/listinfo/vwnc > > _______________________________________________ > vwnc mailing list > [hidden email] > http://lists.cs.uiuc.edu/mailman/listinfo/vwnc > vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc |
Looking at the implementation details of Point class, I'm wondering how many people have written that class. IMO, this class definitely needs some cleanup and consolidation. Just check implementations of Point>>= which expects a Number (this method is copy/pasted from Number>>= .. that is little bit off, because Points are not Numbers and also are not inherited from Number) with Point>><= which expects a Point, and also look at Point>>half (Point>>rounded, Point>>abs, ..) and compare it to implementation of Point>>negated.
This looks like nice work for some junior developer at Cincom - funny way to let him investigate Magnitude hierarchy ;o) -----Original Message----- From: [hidden email] [mailto:[hidden email]] On Behalf Of andres Sent: 30. prosince 2008 19:47 To: VWNC List Subject: Re: [vwnc] Question about coercion and the Magnitude hierarchy Yes. Even though I may not agree on the automatic conversion from numbers to points, I would expect: 2 >= (2@3) 2 asPoint >= (2@3) to give the same result. Best regards, Andrés Vacha Petr escribió: > IMHO, comparing points with numbers falls to same category of operations as comparing Complex numbers with Floats. Don't see reasonable application unless conversion rules between Numbers and Points are defined (even locally relevant). > > However, comparison methods within 7.6 image defined for Points are comparing such that Point is bigger (in terms of > relation ship) if both coordinates are numerically bigger. A number is coerced into Point by using x -> x @ x which is little bit weird for me (don't see logical sense of this conversion). With respect to this definition, expression 2 >= 2@3 should definitely return false. Even if the comparison operation is illogical for me, it should behave consistently with conversion definition used by Point and Number. > > Petr > > -----Original Message----- > From: [hidden email] [mailto:[hidden email]] On Behalf Of Valloud, Andres > Sent: 30. prosince 2008 17:50 > To: [hidden email] > Subject: Re: [vwnc] Question about coercion and the Magnitude hierarchy > > In my opinion, we should have these two things. > > a) consistent behavior, > > b) reasonable behavior. > > At least at first sight, I do not think that comparing numbers with points falls in the "reasonable" category, and so I'd tend to break comparison between numbers and points on purpose so that such an operation raises an "IncomparableQuantities" exception or something of that nature --- thus achieving the "consistent" part. > > Does anybody know a good use of comparison between points and numbers? > > Andres. > > -----Original Message----- > From: [hidden email] [mailto:[hidden email]] On Behalf Of andres > Sent: Monday, December 29, 2008 12:21 PM > To: VWNC List > Subject: [vwnc] Question about coercion and the Magnitude hierarchy > > Hi list, > I was doing some test cases and I bumped into this behavior: > > 2 >= (2@3) > > is true, but: > > (2@2) >= (2@3) > and > (2@3) <= 2 > > are both false. > > The thing is that by combining automatic coercion with the way comparison is implemented in magnitude (i.e. assuming that ">= aMagnitude" means "(self < aMagnitude) not") the first case ends in > (2@2) < (2@3), which is false, and thus >= returns true. On the other hand, the second cases are implemented in Point, comparing the coordinates of 2@3 against 2, which yields (what seems to me) the correct result. So I was wondering if this is the intended behavior or maybe I'm missing something. > > -- > Thanks in advance, > Andrés > _______________________________________________ > vwnc mailing list > [hidden email] > http://lists.cs.uiuc.edu/mailman/listinfo/vwnc > > _______________________________________________ > vwnc mailing list > [hidden email] > http://lists.cs.uiuc.edu/mailman/listinfo/vwnc > > _______________________________________________ > vwnc mailing list > [hidden email] > http://lists.cs.uiuc.edu/mailman/listinfo/vwnc > vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc _______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc |
In reply to this post by Andres Valloud-6
On Tue, 30 Dec 2008 13:17:18 -0500
"Valloud, Andres" <[hidden email]> wrote: > Statement: Comparison between points is an order relation. I don't remember much from my math studies way back when I had more hair and less weight, but I do recall that complex numbers (which map directly to points in a plane) have no canonical order relation. If I get this thread here correctly, there is such an ordering defined in VW. Why? Confused, s. _______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc |
Good question... the one defined for Point is not the only possible
one... there's also the lexicographic order, which is also consistent. However, is it so useful to merit it being the default sort order?... -----Original Message----- From: [hidden email] [mailto:[hidden email]] On Behalf Of Stefan Schmiedl Sent: Tuesday, December 30, 2008 1:28 PM To: [hidden email] Subject: Re: [vwnc] Question about coercion and the Magnitude hierarchy On Tue, 30 Dec 2008 13:17:18 -0500 "Valloud, Andres" <[hidden email]> wrote: > Statement: Comparison between points is an order relation. I don't remember much from my math studies way back when I had more hair and less weight, but I do recall that complex numbers (which map directly to points in a plane) have no canonical order relation. If I get this thread here correctly, there is such an ordering defined in VW. Why? Confused, s. _______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc _______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc |
It's a pretty weird edge case though, comparing a 1-dimensional entity
to a 2-dimensional entity, it's a bit like comparing rational and irrational numbers. I'm not sure there is a "right" way to deal with this kind of comparison. It falls in to the category of "it doesn't really make sense, but if you want to do it, it'll atleast coerce and not crash" Michael Valloud, Andres wrote: > Good question... the one defined for Point is not the only possible > one... there's also the lexicographic order, which is also consistent. > However, is it so useful to merit it being the default sort order?... > > -----Original Message----- > From: [hidden email] [mailto:[hidden email]] On > Behalf Of Stefan Schmiedl > Sent: Tuesday, December 30, 2008 1:28 PM > To: [hidden email] > Subject: Re: [vwnc] Question about coercion and the Magnitude hierarchy > > On Tue, 30 Dec 2008 13:17:18 -0500 > "Valloud, Andres" <[hidden email]> wrote: > > >> Statement: Comparison between points is an order relation. >> > > I don't remember much from my math studies way back when I had more hair > and less weight, but I do recall that complex numbers (which map > directly to points in a plane) have no canonical order relation. > > If I get this thread here correctly, there is such an ordering defined > in VW. Why? > > Confused, > s. > _______________________________________________ > vwnc mailing list > [hidden email] > http://lists.cs.uiuc.edu/mailman/listinfo/vwnc > > _______________________________________________ > vwnc mailing list > [hidden email] > http://lists.cs.uiuc.edu/mailman/listinfo/vwnc > > _______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc |
I think I'd rather have it crash (well, raise an exception). Then,
I'd rethink what I was doing and compare comparable things. Best, C' On Dec 30, 2008, at 2:05 PM, Michael Lucas-Smith wrote: > It's a pretty weird edge case though, comparing a 1-dimensional entity > to a 2-dimensional entity, it's a bit like comparing rational and > irrational numbers. > > I'm not sure there is a "right" way to deal with this kind of > comparison. It falls in to the category of "it doesn't really make > sense, but if you want to do it, it'll atleast coerce and not crash" > > Michael > > Valloud, Andres wrote: >> Good question... the one defined for Point is not the only possible >> one... there's also the lexicographic order, which is also >> consistent. >> However, is it so useful to merit it being the default sort order?... >> >> -----Original Message----- >> From: [hidden email] [mailto:[hidden email]] On >> Behalf Of Stefan Schmiedl >> Sent: Tuesday, December 30, 2008 1:28 PM >> To: [hidden email] >> Subject: Re: [vwnc] Question about coercion and the Magnitude >> hierarchy >> >> On Tue, 30 Dec 2008 13:17:18 -0500 >> "Valloud, Andres" <[hidden email]> wrote: >> >> >>> Statement: Comparison between points is an order relation. >>> >> >> I don't remember much from my math studies way back when I had more >> hair >> and less weight, but I do recall that complex numbers (which map >> directly to points in a plane) have no canonical order relation. >> >> If I get this thread here correctly, there is such an ordering >> defined >> in VW. Why? >> >> Confused, >> s. >> _______________________________________________ >> vwnc mailing list >> [hidden email] >> http://lists.cs.uiuc.edu/mailman/listinfo/vwnc >> >> _______________________________________________ >> vwnc mailing list >> [hidden email] >> http://lists.cs.uiuc.edu/mailman/listinfo/vwnc >> >> > > _______________________________________________ > vwnc mailing list > [hidden email] > http://lists.cs.uiuc.edu/mailman/listinfo/vwnc _______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc |
That would be very nice. Or, if that is deemed too extreme, at least
answer false all the time for comparisons that don't make sense... Andres. -----Original Message----- From: [hidden email] [mailto:[hidden email]] On Behalf Of David Caster Sent: Tuesday, December 30, 2008 2:26 PM To: VWNC List Subject: Re: [vwnc] Question about coercion and the Magnitude hierarchy I think I'd rather have it crash (well, raise an exception). Then, I'd rethink what I was doing and compare comparable things. Best, C' On Dec 30, 2008, at 2:05 PM, Michael Lucas-Smith wrote: > It's a pretty weird edge case though, comparing a 1-dimensional entity > to a 2-dimensional entity, it's a bit like comparing rational and > irrational numbers. > > I'm not sure there is a "right" way to deal with this kind of > comparison. It falls in to the category of "it doesn't really make > sense, but if you want to do it, it'll atleast coerce and not crash" > > Michael > > Valloud, Andres wrote: >> Good question... the one defined for Point is not the only possible >> one... there's also the lexicographic order, which is also >> consistent. >> However, is it so useful to merit it being the default sort order?... >> >> -----Original Message----- >> From: [hidden email] [mailto:[hidden email]] On >> Behalf Of Stefan Schmiedl >> Sent: Tuesday, December 30, 2008 1:28 PM >> To: [hidden email] >> Subject: Re: [vwnc] Question about coercion and the Magnitude >> hierarchy >> >> On Tue, 30 Dec 2008 13:17:18 -0500 >> "Valloud, Andres" <[hidden email]> wrote: >> >> >>> Statement: Comparison between points is an order relation. >>> >> >> I don't remember much from my math studies way back when I had more >> hair and less weight, but I do recall that complex numbers (which map >> directly to points in a plane) have no canonical order relation. >> >> If I get this thread here correctly, there is such an ordering >> defined in VW. Why? >> >> Confused, >> s. >> _______________________________________________ >> vwnc mailing list >> [hidden email] >> http://lists.cs.uiuc.edu/mailman/listinfo/vwnc >> >> _______________________________________________ >> vwnc mailing list >> [hidden email] >> http://lists.cs.uiuc.edu/mailman/listinfo/vwnc >> >> > > _______________________________________________ > vwnc mailing list > [hidden email] > http://lists.cs.uiuc.edu/mailman/listinfo/vwnc _______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc _______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc |
In reply to this post by Michael Lucas-Smith-2
Hi Michael,
> I'm not sure there is a "right" way to deal with this kind of > comparison. Neither do I (e.g. I wouldn't know what order relationship to use with points), but at least I would ask for consistency. > It falls in to the category of "it doesn't really make > sense, but if you want to do it, it'll atleast coerce and not crash" Not even: Consider "(a max: b) x" (2 asPoint max: (1@2)) x = (2@2) x = 2 (2 max: (1@2)) x = (1@2) x = 1 (2 max: (1@1)) x = (2) x = dnu And the fun here is that you may encounter the last dnu at any time of your development cycle. What I guess bothers me the most is that, IMO, these are the kind of errors that may drive you crazy until you find the problem. I would assume that, for example, #max: is commutative. When I write a method I don't want to think if I should do "a max: b" or "b max: a". However: 2 max: (1@1) "2" (1@1) max: 2 "2@2" so it turns out that order does matter :( Best regards, Andrés _______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc |
In reply to this post by Andres Valloud-6
Hmm, I'm not sure I agree.
The problem here is that you've stumbled on the fact that '<' (and the other Magnitude operations, by inference) in a true OO language are not reflexive: {number} < {point} is not always equivalent to {point} < {number}. The question here is whether they should be, either for Magnitudes in general or only for the more restrictive case of ArithmeticValues. I will concede that this seems reasonable for arithmetics since ordering is an inherent part of number theory. Extending this to all magnitudes is a big step and probably not something implementers of Magnitude subclasses are going to appreciate.
Point, as an ArithmeticValue, may need a more meaningful coercion strategy, which would include overriding of the default Magnitude behavior to provide consistent ordering and coercion among all ArithmeticValues subclasses. That could also handle the Complex case, which I think may already be taken care of, since numbers have a well-established escalation policy (going back to ALGOL and FORTRAN or even earlier). On the other hand, it may be that Point should not be an ArithmeticValue at all, because Point is a coordinate (2-dimensional) but all numbers are scalars (1-dimensional), even though points as vector magnitudes are in fact arithmetic (additive, subtractive, scalable). [I'm ignoring Complex numbers because they represent an entirely different order of infinity and confuse everything.]
The real questions here seem to be what should and should not be coercible and how one manages that coercion. Is there a general concept of "coercion" that can be adapted by groups: the obvious numerics, the equally obvious dates/times, and so on? If we follow this idea to some kind of conclusion, logical or insane, there is no reason not to treat dates as comparable to numbers, say by converting to the "normal" format of seconds from an epoch. Where do you stop? I'm not sure "coercible" necessarily means "arithmetic," either: does it mean anything to add two dates together – e.g., what is the sum of 12/07/1941 and 09/11/2001?
Consistency is all very nice, but most of the extended ordering functions do not have an implicit coercion post-condition in the OO world. This is the fallout of Andrés comment on DNUs (posted after I started this). We've crossed a line between number theoretical ideas and VisualWorks' particular implementation, and at least from the idea of arithmetic values, they aren't equivalent. I think it would be well to be consistent, but I'm rather concerned about the adverse side effects of the changes breaking code everywhere.
Cheers!
-----Original Message-----
That would be very nice. Or, if that is deemed too extreme, at least answer false all the time for comparisons that don't make sense...
Andres.
-----Original Message----- From: [hidden email] [mailto:[hidden email]] On Behalf Of David Caster Sent: Tuesday, December 30, 2008 2:26 PM To: VWNC List Subject: Re: [vwnc] Question about coercion and the Magnitude hierarchy
I think I'd rather have it crash (well, raise an exception). Then, I'd rethink what I was doing and compare comparable things.
Best, C'
On Dec 30, 2008, at 2:05 PM, Michael Lucas-Smith wrote:
> It's a pretty weird edge case though, comparing a 1-dimensional entity
> to a 2-dimensional entity, it's a bit like comparing rational and > irrational numbers. > > I'm not sure there is a "right" way to deal with this kind of > comparison. It falls in to the category of "it doesn't really make > sense, but if you want to do it, it'll atleast coerce and not crash" > > Michael > > Valloud, Andres wrote: >> Good question... the one defined for Point is not the only possible >> one... there's also the lexicographic order, which is also >> consistent. >> However, is it so useful to merit it being the default sort order?... >> >> -----Original Message----- >> From: [hidden email] [mailto:[hidden email]] On >> Behalf Of Stefan Schmiedl >> Sent: Tuesday, December 30, 2008 1:28 PM >> To: [hidden email] >> Subject: Re: [vwnc] Question about coercion and the Magnitude >> hierarchy >> >> On Tue, 30 Dec 2008 13:17:18 -0500 >> "Valloud, Andres" <[hidden email]> wrote: >> >> >>> Statement: Comparison between points is an order relation. >>> >> >> I don't remember much from my math studies way back when I had more >> hair and less weight, but I do recall that complex numbers (which map
>> directly to points in a plane) have no canonical order relation. >> >> If I get this thread here correctly, there is such an ordering >> defined in VW. Why? >> >> Confused, >> s. >> _______________________________________________ >> vwnc mailing list >> http://lists.cs.uiuc.edu/mailman/listinfo/vwnc >> >> _______________________________________________ >> vwnc mailing list >> http://lists.cs.uiuc.edu/mailman/listinfo/vwnc >> >> > > _______________________________________________ > vwnc mailing list > http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
_______________________________________________ vwnc mailing list http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
_______________________________________________ vwnc mailing list http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
_______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc |
In reply to this post by Andres Valloud-6
Valloud, Andres escreveu:
> That would be very nice. Or, if that is deemed too extreme, at least > answer false all the time for comparisons that don't make sense... > Andres, It is not extreme, it is plainly wrong. . . Things would appear to be 'working' but problems will haunt us in the future... -- Cesar Rabak GNU/Linux User 52247. Get counted: http://counter.li.org/ _______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc |
In reply to this post by Michael Lucas-Smith-2
-----Original Message----- From: [hidden email] [mailto:[hidden email]] On Behalf Of Michael Lucas-Smith > I'm not sure there is a "right" way to deal with this kind of > comparison. It falls in to the category of "it doesn't really make > sense, but if you want to do it, it'll atleast coerce and not crash" Exactly because being able to dump a bunch of things into an OrderedCollection and ask it to sort without needing to think too hard about what type they are is very nice. _______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc |
In reply to this post by thomas.hawker
On Wed, 31 Dec 2008 07:52:07 +0800
<[hidden email]> wrote: > The question here is whether they should be, > either for Magnitudes in general or only for the more restrictive > case of ArithmeticValues. I will concede that this seems reasonable > for arithmetics since ordering is an inherent part of number theory. > Extending this to all magnitudes is a big step and probably not > something implementers of Magnitude subclasses are going to > appreciate. Just going by the names (and my faint recollections), I'd expect it the other way round from what I hear you say. Arithmetic operations are things like + and *, which work for both ArithmeticValues and Magnitudes. The notion of "magnitude" however, is the one with the implied ordering. In Lisp, I'd now go look for the keys to the multiple inheritance locker, in Ruby, I'd just pull in the "right" measure for making points result in the kind of magnitude I want (right now) via a suitable Module. I'm too tired right now to think about attaching a MagnitudePolicy the subclasses of ArithmeticValue I actually want to use in a Magnitud-y way. Best wishes for the new year, s. _______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc |
In reply to this post by Cesar Rabak
Cesar,
I do not understand what is it that you say is wrong. How would you address this problem? Andres. -----Original Message----- From: Cesar Rabak [mailto:[hidden email]] Sent: Tuesday, December 30, 2008 4:00 PM To: Valloud, Andres Cc: [hidden email] Subject: Re: [vwnc] Question about coercion and the Magnitude hierarchy Valloud, Andres escreveu: > That would be very nice. Or, if that is deemed too extreme, at least > answer false all the time for comparisons that don't make sense... > Andres, It is not extreme, it is plainly wrong. . . Things would appear to be 'working' but problems will haunt us in the future... -- Cesar Rabak GNU/Linux User 52247. Get counted: http://counter.li.org/ _______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc |
In reply to this post by Stefan Schmiedl
According to the Wikipedia, magnitudes can never be negative. This is a
problem because although the current definition of Point>>< even though it makes sense as an order relation, it does not make sense as a magnitude as it appears it would imply the presence of negative magnitude values to support the current behavior. Andres. -----Original Message----- From: [hidden email] [mailto:[hidden email]] On Behalf Of Stefan Schmiedl Sent: Tuesday, December 30, 2008 5:05 PM To: [hidden email] Subject: Re: [vwnc] Question about coercion and the Magnitude hierarchy On Wed, 31 Dec 2008 07:52:07 +0800 <[hidden email]> wrote: > The question here is whether they should be, either for Magnitudes in > general or only for the more restrictive case of ArithmeticValues. I > will concede that this seems reasonable for arithmetics since ordering > is an inherent part of number theory. > Extending this to all magnitudes is a big step and probably not > something implementers of Magnitude subclasses are going to > appreciate. Just going by the names (and my faint recollections), I'd expect it the other way round from what I hear you say. Arithmetic operations are things like + and *, which work for both ArithmeticValues and Magnitudes. The notion of "magnitude" however, is the one with the implied ordering. In Lisp, I'd now go look for the keys to the multiple inheritance locker, in Ruby, I'd just pull in the "right" measure for making points result in the kind of magnitude I want (right now) via a suitable Module. I'm too tired right now to think about attaching a MagnitudePolicy the subclasses of ArithmeticValue I actually want to use in a Magnitud-y way. Best wishes for the new year, s. _______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc _______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc |
Free forum by Nabble | Edit this page |