[REBOL] Re: Correct Behaviour? Was False = 2 ????
From: jelinem1:nationwide at: 2-Jul-2001 11:34
Here is opportunity to stick my foot in my mouth that is too juicy to pass
up.
First of all, IMO associating logic data-types with numerical values is
subjective anyway, and the the argument for choosing 0, 1 (or -1, 0) is
steeped in legacy code of "other languages". Making the statement "pick [a
b c] true" is bastardizing the 'pick functionality unless there is a
fundamental reasoning for allowing a logic value to take the place of an
index. Generally speaking, this is an invalid operation in the "correct"
sense. This operation does have definition, however, FOR A SPECIFIC
LANGUAGE based on that language's implementation.
C programmers know the underlying (and very literal, almost universal)
definition of TRUE and FALSE; REBOL doesn't work that way! 'true and
'false in REBOL do not evaluate to numeric values, but to true logic
types. If we allow them to choose from among elements of a series, what
makes sense <caps>ignoring the implementations of other languages due to
thier deficiencies in supporting true logic types?</caps> I have no
problem with the answer RT have given, and was in fact delighted at
discovering the reasoning (just before I read the next reply which stated
this). That is, everytime you used 'if and 'either you were already
performing "pick [[code1] [code2]] <logic value>"! From a generic
programming perspective, what could make more sense?
Besides, as was also pointed out, if you want your "usual" numeric values
of 'true, 'false use 'to-integer.
> Quick & Dirty REBOL User Poll.
> 1. Should Series! Index begin at Zero?
Absolutely not. If you truly think in terms of "index" then yes, but
(being a human being, not a C program) I think in terms of "position".
> 2. Should 0, None & False be equivalent
> for 'PICKing values from a series! and
> return the FIRST or index 0 value whereas
> True and 1 would return the SECOND or
> Index 1 value?
No. See my interpretation of existing REBOL functionality above.
- Michael, going to eat something more wholesome, now