[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Chicken-janitors] #575: Extended lambda list syntax with default values
From: |
Chicken Trac |
Subject: |
[Chicken-janitors] #575: Extended lambda list syntax with default values isn't checked properly |
Date: |
Tue, 17 May 2011 10:00:47 -0000 |
#575: Extended lambda list syntax with default values isn't checked properly
----------------------------------------------------+-----------------------
Reporter: sjamaan | Owner: felix
Type: defect | Status: new
Priority: minor | Milestone: 4.8.0
Component: expander | Version: 4.6.x
Keywords: DSSSL lambda list, keywords, optionals |
----------------------------------------------------+-----------------------
When using a default value with an optional argument, you get a strange
error message that there's an error in your LET syntax, and when you do
the same with a keyword argument, Chicken segfaults.
The reason is there's a missing check in {{{##sys#expand-extended-lambda-
list}}}'s final {{{cond}}} clause; it implicitly assumes that a 2-element
list after {{{#!key}}} or {{{#!optional}}} always has a symbol as its car.
The attached patch contains a simple fix and regression test.
{{{
CHICKEN
(c)2008-2010 The Chicken Team
(c)2000-2007 Felix L. Winkelmann
Version 4.6.0
netbsd-unix-gnu-x86-64 [ 64bit manyargs dload ptables ]
compiled 2011-01-21 on langly (NetBSD)
#;1> (define (foo #!optional 0) 1)
Error: invalid lambda list syntax: (#!optional 0)
Call history:
<syntax> (define (foo #!optional 0) 1)
<syntax> (##core#set! foo (##core#lambda (#!optional 0)
1))
<syntax> (##core#lambda (#!optional 0) 1) <--
#;1> (define (foo #!optional (0 0)) 1)
Error: during expansion of (let12 ...) - in `let' - symbol expected: (let
((0 (optional tmp 0))) 1)
Call history:
<syntax> (define (foo #!optional (0 0)) 1)
<syntax> (##core#set! foo (##core#lambda (#!optional (0
0)) 1))
<syntax> (##core#lambda (#!optional (0 0)) 1) <--
#;1> (define (foo #!key 0) 1)
Error: invalid lambda list syntax: (#!key 0)
Call history:
<syntax> (define (foo #!key 0) 1)
<syntax> (##core#set! foo (##core#lambda (#!key 0) 1))
<syntax> (##core#lambda (#!key 0) 1) <--
#;1> (define (foo #!key (0 0)) 1)
zsh: segmentation fault csi
}}}
--
Ticket URL: <http://bugs.call-cc.org/ticket/575>
Chicken Scheme <http://www.call-with-current-continuation.org/>
Chicken Scheme is a compiler for the Scheme programming language.
- [Chicken-janitors] #575: Extended lambda list syntax with default values isn't checked properly,
Chicken Trac <=