chicken-hackers
[Top][All Lists]
Advanced

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

Re: [Chicken-hackers] [PATCH] small scrutinizer enhancement


From: Peter Bex
Subject: Re: [Chicken-hackers] [PATCH] small scrutinizer enhancement
Date: Fri, 12 Oct 2012 21:19:59 +0200
User-agent: Mutt/1.4.2.3i

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



reply via email to

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