Opened 13 years ago

Closed 13 years ago

#870 closed defect (fixed)

SRFI-13's string comparison procedures return integers

Reported by: Mario Domenech Goulart Owned by:
Priority: major Milestone:
Component: core libraries Version: 4.7.x
Keywords: srfi-13, string comparison Cc:
Estimated difficulty:

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.

Attachments (1)

0001-Ensure-that-srfi-13-string-and-its-string-comparison.patch.txt (3.9 KB) - added by Jim Ursetto 13 years ago.

Download all attachments as: .zip

Change History (4)

comment:1 Changed 13 years ago by Jim Ursetto

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.

comment:2 Changed 13 years ago by Jim Ursetto

Eh, here's a patch. Barely tested, I only checked string= and string<>.

comment:3 Changed 13 years ago by sjamaan

Resolution: fixed
Status: newclosed

Fixed by abf5ae1e4a5025cbf03b24c6ce8574ceb5af12b1

Note: See TracTickets for help on using tickets.