[REBOL] Re: R: Re: Correct Behaviour? Was False = 2 ????
From: robbo1mark:aol at: 3-Jul-2001 6:06
Everybody,
Interesting to note peoples points and reasonings
on this thread & for what it's worth I think they
all have some validity.
Regards Indexing starting at Zero, I have mixed
views on this and still haven't firmly decided
which side of the fence I fall on although I
think I lean towards the zero position. For
instance 'HEAD is always index 1 whereas 'TAIL
is always ( index? last + 1 ), I see 'TAIL as
being correct because it is the position after
the last element of a series!
If you accept that as true then surely 'HEAD of
a series! should be index position zero, agreed?
In my view this should be the "correct" behaviour
>> index? head [a b c]
== 0
My Reasoning being 'INSERT joins values to the head
of a series! "before" the first element.
With regards to me "giving" 'PICK the ability to
accept NONE as an index position, this was only
done for example purposes to highlight a further
inconsistency in REBOL.
The Conditional Functions like 'IF & 'EITHER accept
NONE as the logical equivalent of 'FALSE.
>> either none [ true ] [ false ]
== false
Therefore if you can do this....
>> pick [true false] false
== false
>> pick [true false] true
== true
Then why not this......
>> pick [true false] none
== false
After all.....
>> to-logic none
== false
Either 'none is the logical equivalent of 'false or
it isn't? As it currently stands as these examples show
that this is the case except when it's not! and that
hardly leads to consistency, clarity or ease of learnability
and understanding.
I think for clarity & consistency & simplicity this should
be the case......
FALSE = NONE = 0
Reasoning...
>> to-logic none
== false
>> to-logic 0
== false
>> to-integer false
== 0
>> to-integer none
== 0
And if you give 'PICK the ability to utilise logic! or
conditional values then saying
>> pick [true false] false
== false
>> pick [true false] 0
== false
>> pick [true false] none
== false
IMHO Should be the "correct" behaviour however ally that to
zero indexing for series! and preferably you would
have this as the "correct" behaviour....
>> pick [false true] false
== false
>> pick [false true] 0
== false
>> pick [false true] none
== false
>> pick [false true] true
== true
>> pick [false true] 1
== true
Simple, Consistent & easy to learn & remember!
Certainly easier than False = 0 except when it equals 2 as
we currently have.
I think it was Volker who said "Plain English for Computers."
Well as somebody who speaks english / scots as my natural language
plain
is hardly a term I would describe for the language.
English as a language is an amalgation of Olde English / Germanic,
Latin / French, Celtic / British, Norse, Pictish to name but a few
of it's origins.
I thought REBOL wanted to be "Simple, Powerful, Elegant"
English whilst certainly Powerful and often extremely Elegant
can in no ways be described as simple.
The Cow -> Beef, Pig -> Pork, distinctions are only one example
of multi-lingual variation in English.
The former terms originate with the odle english / germanic names
for the animals whereas the latter derive from french words for the
flesh or meat of these animals and were introduced into english
language in Norman times.
Sure we all want context sensitivity and power of natural languages
in REBOL but surely not also all the baggage & idiosyncracies of
them as well?
For me 'First is logically simple and compatable with Index position
zero.
I know this is all what-if anyway because what I have suggested is
probably too deep a change for REBOL and would break backwards
compatability of both source code AND existing documentation / books
etc. so REBOL will most probably not be changed.
However there is no harm in thinking / suggesting how simple, consistent
and easier REBOL could be with no loss of power or expressability or
elegance. REBOL 2.x came into being in 1998 so that is only 3 years
backwards compatability. Surely we expect REBOL 3++ to be around a LOT
longer than that, IMHO better to change now / then than live with
inconsistency / the "wrong" way forever! And That is the Microsoft Way!
Cheers,
Mark Dickson
In a message dated Tue, 3 Jul 2001 5:19:52 AM Eastern Daylight Time, Chris <[chris--starforge--demon--co--uk]>
writes:
<< Romano Paolo Tenca wrote:
> The zero element of a series does not exist.
Unless you've programmed C for the best part of a decade, in which case
all this talk of starting arrays and series at 1 takes a bit of getting
used to.... ;)
Chris
--
New sig in the works
Explorer2260 Designer and Coder
http://www.starforge.co.uk