Comments on: Changes to ordinal functions
The ordinal functions are first, second, third, ..., last, etc.
There are two changes of interest:
| Change1 | Ordinals are now of type native! not action!
|
| Reason | Polymorphic application of these functions across all series datatypes improves the implementation.
|
And:
| Change2 | Ordinals no longer throw an error on a past-end condition.
|
| Reason | Behavior is now similar to pick, returning none when past end. Experience has shown that making the ordinals throw errors when past-end was not convenient for the most common coding practices.
|
7 Comments Comments:
James_Nak 22-Aug-2006 18:23:16 |
Excellent! I don't know how many times I've hit the past-end error. Thanks also for making my favorite function append a native. It makes an appearance at least once an app and usually more since I'm such a "block-head." | Gregg Irwin 23-Aug-2006 11:35:07 |
Nice change! I think the consistency will help. I know there are times I choose not to use them due to the error problem. | Ladislav Mecir 23-Aug-2006 11:55:23 |
I will be missing the current behaviour (my reasons are explained in http://en.wikibooks.org/wiki/REBOL_Programming/Language_Features/Series article), but I can adapt to the change. | Carl Sassenrath 24-Aug-2006 23:58:48 |
Yes, indeed, there was an original reason for the way they worked. But, I ran in to too many issues when using them for variable length series. | Maxim Olivier-Adlhoch 25-Aug-2006 15:51 |
Although I understand the cause and do appreciate it for many scripts (it will be simpler than pick series 1)...
can the old versions be available otherwise? a global switch or error throwing mezz (differerently spelled), something?
Now we cannot know if the value really is a none or if the series was invalid.
| Maxim Olivier-Adlhoch 25-Aug-2006 15:57:59 |
OT, With this and other changes, at this point, I wonder how many R2 scripts will still run under R3.
Carl, have you considered changing/extending the REBOL [] header to make it clear the script is a R3 specific version?
REBOL3 [] R3 [] REBOL [needs: 'R3] RT []
? | Carl Sassenrath 31-Aug-2006 14:26:05 |
I would be surprised if this change affected that many scripts, but it is definitely a factor to consider. (There are other areas that will have much greater impact, for example the PORT! datatype.)
The REBOL header can specify:
REBOL [needs: [3.0.1]]
and
REBOL [needs: 3.0.1]
And we will also accept:
REBOL [needs: 3]
Note that we don't normally allow decimal (3.0), because the decimal comparison is not exact. However, it is probably possible to allow that too. |
Post a Comment:
You can post a comment here. Keep it on-topic.
|