[REBOL] Re: Tuples - Was Pair! thread
From: carl:cybercraft at: 7-Feb-2002 21:02
On 07-Feb-02, [Robbo1Mark--aol--com] wrote:
> Holger / Joel / Everybody
> being following this thread with interest,
So have I.
> is there any reason then why comparators should
> work with tuples?
>>> 1.1.2 > 1.2.1
> == false
> seems reasonable to me, but then again so do Joels arguments /
> logic, saying pair! are only meant to be used strictly in a
> Rebol/View pixel co-ordinate context seems like a cop out to me,
> either that or insufficient thought goes into REBOL language design
> & implementation, which is it Holger?
I'd say neither, though it wouldn't surprise me if Holger thought his
comments regarding View and pair! could've been better put, or at
least more fully explained. (I wonder if you do regarding the
above?)
But anyway, let's rephase your first question:
Is there any reason then why comparators shouldn't work with tuples?
I'd think not, but with pairs there is a reason, in that it could be
confusing. Tuples have a few common uses - as RGBs, version numbers,
net-addresses and such, but they don't favour any of them (as far as
I know). Pairs though do favour 2 dimensional coordinates and sizes
as apposed to other uses of them, hence their x and y refinements.
Given that, what should a pair comparison compare?
Size? As in the area of two pairs? Well no, as we can at least check
if two pairs are equal, and it says 3x2 isn't equal to 2x3. (No
doubt someone's already pointed this out.)
Coordinates? As in the distance from 0x0? Well, perhaps, even though
I'd guess you're more likely to want to compare a coordinate with a
point other than 0x0 most of the time. This would be useful
sometimes, anyway.
Or should it be treated like a series? I'd say no, as even if I
needed a series of just two numbers, I don't think I'd choose a pair
for the job. (How many of you have used pairs for other than coords
or sizes?)
My point here is that comparing pairs as if they were series is the
least intuitive and probably the least likely use for comparing them,
which to my mind is a good reason not to allow it. If pairs are to
be compared then it should be as coordinates, as I think this is what
you'd expect a comparison of pairs to be doing.
All things considered though, it's quite easy to see why RT thought
comparing pairs is confusing and decided not to support it.
--
Carl Read