chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] can't get 'the' to work


From: Jörg F . Wittenberger
Subject: Re: [Chicken-users] can't get 'the' to work
Date: 25 Mar 2013 14:13:10 +0100

On Mar 25 2013, Moritz Heidkamp wrote:

 (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

It seems you can trick the compiler by using something like this:

 (the (list-of number) (apply list '()))

I'm not sure whether that's how THE BOSS intended the -strict-types
option to be (ab)used though :-)

Thanks for this idea!

Better follow Peter's advice of getting
rid of the mutation.

Hm, the example is stripped down from some argument parsing.

Given N many bindings, wouldn't it be it a bit expensive to
unroll the simple case-dispatch into N eq?-Tests?  Let alone
that the code would become quite unreadable.  (Though this
could eventually be handled by macro expansion.)

So I'd better resort to some compiler-trickery to get the
explicit "the" declaration to work.

Thanks again

/Jörg



........






reply via email to

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