chicken-users
[Top][All Lists]
Advanced

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

[Chicken-users] Allowing unspecified key arguments in functions


From: Amir Teymuri
Subject: [Chicken-users] Allowing unspecified key arguments in functions
Date: Fri, 26 Jul 2019 10:58:35 +0200

I had a question about the objectives and reasons of allowing
un-specified key arguments in functions as soon as i want to have some
key arguments. Take a look at the following case:

;;; The function
(define (foo a #!key b) (list a b))

Now passing any number of key arguments in addition to b doesn't
result in any error which makes the debugging of even some simple
typing errors very difficult in a large code:

(define (foo a #!key b) (list a b))
(foo 2) ; ===> (2 #f)
(foo 2 #:b 3) ; ===> (2 3)
(foo 2 #:b 3 #:c 4 #:d 5 #:e 6) ; ===> (2 3)

without any errors!  Why is this and what was the reasons of deciding
this too much freedom?

Regards,
Amir



reply via email to

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