Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search

[REBOL] Re: On ordinal and cardinal numbers...

From: jeff:rebol at: 7-Jul-2001 13:40

> I assumed that the other option that had been raised > (having some sort of global flag that would switch all > existing words between 1- and 0-origin behavior) was not > acceptable/feasible.
A setting verses replicating all the series actions for zero based indexing. If you globally set your base you'll break at least half the scripts you DO, pretty much forever. Some algorithms will be agnostic to the base, but many will not (as Joel Neely has been showing). Programmers shouldn't have to write their code twice for each base that your REBOL might be running under. I tongue and cheek mentioned before about a NEEDS field: REBOL [Title: "Mostly portable" index: 0] ... I've been contemplating that idea: A zero based script DOes a 1 based script (the default) which in turn DOes a zero based script -- etc. Code from the 1 based script calls code from the 0 based script, so REBOL needs to go "Oh, this code over here wants zero, that code wants 1, etc. okay... Now the last 0 based script takes some function that operates on series from a 1 based script that it DOes, binds this into one of its objects containing a number of other functions that operate on series, molds it and stuffs it through a port, which is sucked out on the other side of the Internet by a 1 based script that uses the object to calculate your bank balance ... hmm.. how to keep track of which base belongs to which piece of totally dynamic code... uhhh.. On second thought, replicating all the series actions is sounding much more preferable. (Or changing the base all together and breaking most existing scripts. Weee!) -jeff