#805 closed defect (fixed)
case-lambda is unhygienic
Reported by: | Moritz Heidkamp | Owned by: | Christian Kellermann |
---|---|---|---|
Priority: | minor | Milestone: | 4.9.0 |
Component: | core libraries | Version: | 4.7.x |
Keywords: | Cc: | ||
Estimated difficulty: |
Description
case-lambda
unhygienically expands to length
. To wit:
#;1> (module foo (foo) (import (only scheme quote) (prefix chicken c/) (prefix scheme s/)) (s/define foo (c/case-lambda ((a) a) ((a b) b)))) Warning: reference to possibly unbound identifier `length' in: Warning: foo Error: module unresolved: foo
I tried the following fix but it doesn't seem to change a thing:
diff --git a/chicken-syntax.scm b/chicken-syntax.scm index 08bede2..a6c70d4 100644 --- a/chicken-syntax.scm +++ b/chicken-syntax.scm @@ -785,11 +785,12 @@ (%>= (r '>=)) (%eq? (r 'eq?)) (%car (r 'car)) - (%cdr (r 'cdr))) + (%cdr (r 'cdr)) + (%length (r 'length))) `(##core#lambda ,(append minvars rvar) (##core#let - ((,lvar (length ,rvar))) + ((,lvar (,%length ,rvar))) ,(fold-right (lambda (c body) (##sys#decompose-lambda-list
Does anyone know what's going on?
Change History (4)
comment:1 Changed 13 years ago by
Owner: | set to Christian Kellermann |
---|---|
Status: | new → accepted |
comment:2 Changed 13 years ago by
Ah, so that's what I was overlooking. Works brillantly now. Can you create a format-patch version of this fix for me to sign it off? Thanks!
comment:3 Changed 13 years ago by
Resolution: | → fixed |
---|---|
Status: | accepted → closed |
Note: See
TracTickets for help on using
tickets.
Does the following patch solve the issue for you?