[REBOL] Re: Rebol interpreter bug with comparison of dates
From: jan:skibinski:sympatico:ca at: 3-Dec-2002 21:56
Carl Read wrote:
> On 04-Dec-02, Jan Skibinski wrote:
>
> > Hi Andrew,
>
> > The problem seems to be much broader:
> >>> 2 < 'foo
> > ** Script Error: Expected one of: integer! - not: word!
>
> > But at least in this case the error message makes some sense.
>
> > Personally, I don't mind such a behaviour, which disallows
> > comparison of apples to oranges. But I think the definition
> > of (<) is too broad: it should be more specific - narrowed
> > down to the orderable things, such as numbers, dates,
> > but not points, etc. However, since the arguments of this
> > operator are untyped, the "help <" suggests that one can
> > compare anything to anything - and hence those unpleasent
> > runtime surprises.
>
> > Jan
>
> Going by previous comments, I think the comparing of different types
> is allowed so routines for soting them will work. ie...
>
> >> sort [2 foo]
> == [foo 2]
> >> sort [foo 2]
> == [foo 2]
>
> --
> Carl Read
>
Hi Carl,
But there is a lack of consequence, because this works:
>> sort/compare [1 3 11 2] (func[x y][x > y])
== [11 3 2 1]
and this fails:
>> sort/compare [2 foo] (func[x y][x > y])
** Script Error: Expected one of: integer! - not: word!
Jan