chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] Bug with #!optional in Chicken 4.8.0


From: Jörg F . Wittenberger
Subject: Re: [Chicken-users] Bug with #!optional in Chicken 4.8.0
Date: 14 Oct 2012 19:58:30 +0200

On Oct 14 2012, Felix wrote:

From: John Croisant <address@hidden>
Subject: [Chicken-users] Bug with #!optional in Chicken 4.8.0
Date: Sat, 13 Oct 2012 20:34:26 -0400

In Chicken 4.8.0, procedures defined with #!optional no longer signal
an exception if invoked with too many arguments. For example:

(define (foo x #!optional y) (list x y))
(foo 'x 'y 'too 'many 'args)

In Chicken 4.7, this would signal an exception, because the foo
procedure expects a maximum of 2 arguments. In Chicken 4.8, the extra
arguments are simply ignored.

I think this is a bug, because the docs for "Extended DSSSL style
lambda lists" say:

If there is no rest-parameter  and no keyword-parameters in the
parameter-list, then it shall be an error for any extra arguments to
be passed to the procedure.

That is correct. The check has been removed and conflicts with
the documentation. I will update the docs accordingly.
The check has been removed to accomodate a terrible hack for handling
re-initialization of parameters with "parameterize", and for a slight
performance win. The hack is so terrible, I hardly dare to talk about
it in public.

I'm afraid go disappoint you Felix. But thats exactly the kind of hack
some (like me) love to learn about.

Not as a papparazzi and certainly not in doc, which are ever updated.
But there is much more go learn from a dirty (intermediate) hack explained
than a thousend "best practice examples as working".

On the other hand, I see no problem in allowing extra
parameters to lambdas with rest/optional arguments being silently
dropped - it has been done before.


cheers,
felix

_______________________________________________
Chicken-users mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/chicken-u



reply via email to

[Prev in Thread] Current Thread [Next in Thread]