Summary
SRFI-13's string comparison procedures return integers
Metadata
- Id: 137379ad3663991c95bf5ccf0655e3713a9262c4
- Trac id: 870
- Type: defect
- Reporter: mario
- Owner:
- Cc:
- Status: closed
- Component: core libraries
- Estimated difficulty:
- Resolution: fixed
- Priority: major
- Milestone:
- Version: 4.7.x
- Changetime: 2012-06-30 15:23:45 UTC
- Created: 2012-06-19 01:58:15 UTC
- Keywords: srfi-13, string comparison
Attachments
- 137379ad3663991c95bf5ccf0655e3713a9262c4/attachments/0001-Ensure-that-srfi-13-string-and-its-string-comparison.patch.txt
Description
CHICKEN procedures from the srfi-13 unit for string comparison return integers, while SRFI-13 (and the wiki documentation for SRFI-13) state that they return booleans.
The following SRFI-13 procedures (and their case-insensitive counterparts) return integers in chicken:
* string= * string<> * string<= * string< * string>= * string>
I'm not sure if the behavior of these procedures in CHICKEN deviate from SRFI-13's by design or if it is really a bug.
If that's the intended behavior, we have to fix the documentation and add a note about that deviation.
Changes and comments
[2012-06-19 03:03:17 UTC] zbigniew wrote:
Ref impl is obviously wrong and the bug was propagated to Chicken. It uses string-compare's PROC= branch and returns its value and, as string-compare states, "in the case of PROC=, it is always END1" -- not a boolean. Changing "values" to (lambda (i) (and i)) should fix it.
Question is, who is right--the guy that wrote the srfi, or the guy that wrote the reference implementation.
The answer is they are both right. Please, put down the Sig Sauer, I beg you.
[2012-06-19 03:18:54 UTC] zbigniew attached 0001-Ensure-that-srfi-13-string-and-its-string-comparison.patch.txt (description=#f)
[2012-06-19 03:19:37 UTC] zbigniew wrote:
Eh, here's a patch. Barely tested, I only checked string= and string<>.
[2012-06-30 15:23:45 UTC] sjamaan changed status from new to closed
[2012-06-30 15:23:45 UTC] sjamaan set resolution to fixed
[2012-06-30 15:23:45 UTC] sjamaan wrote:
Fixed by abf5ae1e4a5025cbf03b24c6ce8574ceb5af12b1