On Fri, Oct 12, 2012 at 07:21:52PM +0200, Felix wrote:
> During flow-analysis, when a predicate is applied to a variable, the
> variable is assumed to have the corresponding type in the consequent
> branch of a conditional that depends on this predicate call. This
> patch adds a small enhancement that, in case the variable type is
> known to be a typeset (an "(or ...)" type), reduces the typeset by
> removing those types that match the predicate-type:
> 
> (let ((a ...))  ; say "a" is of type "(or string number)"
>   (if (number? a)
>       ...           ; "a" is known to be of type "number"
>       ...))         ; "a" is now known to be of type "string"  <- new
> 
> Here "number" matches the predicate type of "number?" ("number"),
> is removed from the "(or string number)" type, and results in
> type "string" for "a" in the second "if" branch.

I always assumed it already did that ;) Thanks for the patch, to
actually make it so!  I've pushed it.

Cheers,
Peter
-- 
http://sjamaan.ath.cx
--
"The process of preparing programs for a digital computer
 is especially attractive, not only because it can be economically
 and scientifically rewarding, but also because it can be an aesthetic
 experience much like composing poetry or music."
                                                        -- Donald Knuth

_______________________________________________
Chicken-hackers mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/chicken-hackers

Reply via email to