[REBOL] I hate computers!
From: edanaii::cox::net at: 4-Jan-2003 9:34
No, really! I do.
Well, OK, when they don't do what I want, I hate 'em. :)
This is driving me nuts. I whipped up a small routine to validate
parameters. It is relatively simple, You pass it the parameter, you pass
it a series full of datatypes, it compares the two and tells you if your
parameter's datatype is valid (IOW, in the series).
But it's actin' strangely.
Here it is:
Valid-Type?: Func [ Parameter [Any-Type!]
ForEach DataType DataTypes [
If (Type? Parameter) = DataType [
The problem is in the line "If (Type? Parameter) = DataType" it just
doesn't work. When I call the routine, it does this:
>> Valid-Type? "x" [ String! Money! Integer! ]
Which is incorrect. It should be "true" since "x" is clearly a string.
The only way it works, is when I change the line in question to "If
(join (to-string Type? Parameter) "!") = (to-string DataType)", which is
a little counter-intuitive.
So, bug or oversight? And is there, as always, a more elegant way of
Sincerely, | The problems of two little people don't amount to
Ed Dana | a hill of beans in this crazy mixed-up world! But
Software Developer | this is OUR hill, and these are OUR beans!
1Ghz Athlon Amiga | -- Leslie Neilson, Naked Gun (Casablanca).