bugKawa - Bugs: bug #28022, case-lambda (srfi 16) not working...

 
 

bug #28022: case-lambda (srfi 16) not working with strings

Submitted by:  Andrea Girotto <andreag>
Submitted on:  Sun 15 Nov 2009 09:18:14 AM UTC  
 
Category: Scheme librarySeverity: 3 - Normal
Item Group: Unexpected resultStatus: Fixed
Privacy: PublicAssigned to: Per Bothner <bothner>
Open/Closed: Closed

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Sun 06 Dec 2009 10:08:44 PM UTC, comment #1:

Thanks for the bug report. It turned out that the problem had nothing to do with strings per se, but how GenericProc is implemented: There were two bugs: We were sorting the "methods" by specificity, and the test for "most specific" was wrong. Fixing either would fix the bug, but I thought it best to fix both.

I converted your helpful test-case to SRFI-64-style, and fixed a couple of errors in the test-case. Fixes and test-case now checked in.

Per Bothner <bothner>
Project AdministratorIn charge of this item.
Sun 15 Nov 2009 09:18:14 AM UTC, original submission:

"case-lambda" works correctly with numbers a arguments but fails if arguments are strings. See the testsuite attached: with the current case-lambda implementation ("Kawa 1.9.90 (revision 6301:6308)" and "Kawa 1.9.90 (revision 6451)") the last tests fail.

I redefined it this way (seems to work, at least successfully completes the testsuite and it is enough for my application):

(define-syntax case-lambda
(syntax-rules (values: definition:)
((case-lambda)
(lambda values
(syntax-error "case-lambda without any clauses") ) )

((case-lambda (arg0 exp0 ...) cla1 ...)
(lambda values
(case-lambda values: values (length values) definition: (arg0 exp0 ...) cla1 ...) ) )

((case-lambda values: values val-len definition: ((arg0 ...) exp0 ...) cla1 ...)
(if (= val-len (length '(arg0 ...)))
(apply (lambda (arg0 ...) exp0 ...) values)
(case-lambda values: values val-len definition: cla1 ...) ) )

((case-lambda values: values val-len definition (arg0 exp0 ...) cla1 ...)
(let ((arg0 values))
exp0 ... ) )

((case-lambda values: values val-len definition:)
(syntax-error "wrong number of arguments to case-lambda") )

((case-lambda all ...)
(syntax-error "invalid case-lambda syntax") )
) )

Andrea Girotto <andreag>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

Attached Files
file #19057:  srfi-16-test.log added by andreag (907B - text/x-log - Test suite and log for srfi-16)
file #19056:  srfi-16-test.scm added by andreag (932B - text/x-scheme - Test suite and log for srfi-16)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by bothner (Posted a comment)
  • -unavailable- added by andreag (Submitted the item)
  • -unavailable- added by andreag
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 6 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sun 06 Dec 2009 10:08:44 PM UTCbothnerStatusNone=>Fixed
      Assigned toNone=>bothner
      Open/ClosedOpen=>Closed
    Sun 15 Nov 2009 09:18:14 AM UTCandreagCarbon-Copy-=>Added -unavailable-
      Attached File-=>Added srfi-16-test.scm, #19056
      Attached File-=>Added srfi-16-test.log, #19057

    Back to the top


    Powered by Savane 3.1-cleanup1