#385 closed defect (fixed)
Better error reporting for srfi-26
| Reported by: | sjamaan | Owned by: | felix winkelmann |
|---|---|---|---|
| Priority: | minor | Milestone: | 4.9.0 |
| Component: | core libraries | Version: | 4.6.x |
| Keywords: | srfi-26, cut, cute | Cc: | |
| Estimated difficulty: |
Description
((cut + <...> 1) 1) is allowed and returns 1, contrary to expectations.
(cut) and (cute) both give an internal error; "Error: (car) during expansion of (cute ...) - bad argument type: ()". This should be a more contextually relevant error.
Here's two patches; one allows suffix patterns, the variables for which simply get consumed placewise from the right (similar to #379). Normal variables get consumed from the left and if anything's left in between, that's used for the placeholder. The above example would return 2.
The other patch simply checks for the presence of extra args and throws an error if there are any.
Both patches add an error message for when you do (cut).
Attachments (2)
Change History (13)
by , 15 years ago
| Attachment: | srfi-26-extension.patch added |
|---|
comment:1 by , 15 years ago
As you probably noticed, I also added the srfi-26 testcases from the srfi document to Chicken's test cases for future hacking on it.
comment:2 by , 15 years ago
By the way, if chop from data-structures or take-right and drop-right from srfi-1 would be available in the syntax code, both this and #379 could be simplified (and this one would be a little more efficient, I suppose).
comment:4 by , 15 years ago
By the way: I considered adding the extension because currently we have no real alternative for the now removed left-section & right-section (unless I'm missing something, which is quite possible). This extension would allow the following conversion:
((left-section list 1 2 3) 4 5 6) <=> ((cut list 1 2 3 <...>) 4 5 6) ((right-section list 4 5 6) 1 2 3) <=> ((cut list <...> 4 5 6) 1 2 3)
comment:6 by , 15 years ago
follow-up: 8 comment:7 by , 15 years ago
Sorry about that. I replaced it with one that does work.
(of course, secretly, I sabotaged this one hoping you'd apply the more feature-rich one...But you foiled the plan!)
comment:8 by , 15 years ago
Replying to sjamaan:
Sorry about that. I replaced it with one that does work.
Thanks - now it has been committed.

The version that adds an extension that allows tail patterns