[REBOL] Enhancement Request - Range! datatype Re:(4)
From: al:bri:xtra at: 21-Aug-2000 17:55
Gary wrote:
> I like the range idea but would suggest the use of a different operator
than '-' - possibly '..' which is used in several other languages?
Gabriele wrote:
> The dash is what is used in human languages, so I agree with Andrew here.
What's the problem with it?
Gary wrote:
> It would seem that trying to distinguish between a range literal and a
word (which can have dash characters), or an issue literal which uses dashes
presents a problem for both people and REBOL.
I tried it with Rebol. First here's a range! literal:
>> r: 1-10
** Syntax Error: Invalid date -- 1-10.
** Where: (line 1) r: 1-10
Of course, it doesn't work, 'cause it's an invalid time.
Here's a valid time. Note that I need to put in a year:
>> r: 1-10-95
== 1-Oct-1995
Now here's an issue. Note that the issue needs a "#" mark, as used in human
languages:
>> r: #1-10
== #1-10
Now here's what Rebol would produce, with a 'range! datatype, and some
common operator words refinements:
>> r: 1-10
== 1-10
>> type? r
== range!
>> first r
== 1
>> second r
== 10
>> source r
r: 1-10
>> r/first
== 1
>> r/last
== 10
I think it looks nice. Of course, there could be some problem I haven't seen
yet with it. Can anyone think of anything?
Andrew Martin
ICQ: 26227169
http://members.xoom.com/AndrewMartin/