I tried to fix my testcase using "the" as below.
Does't work:
Warning: in toplevel procedure `foo#bar':
expression returns a result of type `null', but is declared to return
`(list-of number)', which is not a subtype
This alternative is not any better:
(let ((foobar (the (or null (list-of number)) '())))
Warning: in toplevel procedure `foo#bar':
expression returns a result of type `null', but is declared to return
`(list-of number)', which is not a subtype
Note that the compiler's compaint removed the (or null ...) part.
It does not so, if I try to use boolean instead of null; then
it at least complains including the bool.
(module
foo
(bar)
(import scheme chicken)
(define (bar . args)
(let ((foobar (the (list-of number) '())))
(do ((rest args (cddr rest)))
((null? rest)
(if (null? foobar)
'gaga
foobar))
(if (null? (cdr rest))
(error (car rest)))
(case (car rest)
((#:foobar)
(set! foobar (cons (cadr rest) foobar)))))))
)
(import foo)
(display (bar #:foobar 42))
(newline)
_______________________________________________
Chicken-users mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/chicken-users