--- Begin Message ---
Subject: |
case-lambda should accept zero clauses |
Date: |
Mon, 17 Oct 2011 12:15:40 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) |
Hello guilers,
the case-lambda form is specified in r6rs-lib as accepting any number of
clauses, including zero. So this should not give an error:
scheme@(guile-user)> (case-lambda)
While compiling expression:
ERROR: Syntax error:
standard input:1:0: case-lambda: bad case-lambda in form (case-lambda)
Instead it should return a procedure that never gets the right number of
arguments.
Regards,
--
Göran Weinholt <address@hidden>
--- End Message ---
--- Begin Message ---
Subject: |
Re: bug#9776: case-lambda should accept zero clauses |
Date: |
Sat, 09 Mar 2013 11:17:44 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux) |
On Sat 02 Mar 2013 19:13, Andy Wingo <address@hidden> writes:
> Picking up an old thread. What do people think about the attached
> patch? It preserves arity checking for case-lambdas defined in the same
> compilation unit. Case-lambdas are converted to nullary procedures in
> the last minute, before compiling or memoizing. Calling one of these
> procedures with arguments will still produce an arity-check warning;
> calling one without arguments will not. In both cases a
> wrong-number-of-args exception is thrown at runtime (either by the
> normal argument count check or via the explicit throw in the body).
>
> I think allowing lambda-body to be #f is the right way to go because it
> precludes inlining of ((case-lambda)).
>
> I'll push soon if there are no comments.
Pushed. Later we can figure out a way to warn for all applications of
(case-lambda), regardless of arity.
Andy
--
http://wingolog.org/
--- End Message ---