chicken-hackers
[Top][All Lists]
Advanced

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

Re: [Chicken-hackers] testcase -strict-types


From: Moritz Heidkamp
Subject: Re: [Chicken-hackers] testcase -strict-types
Date: Mon, 25 Mar 2013 10:13:35 +0100

Jörg F. Wittenberger <address@hidden> writes:
> Though in a way the explanation is correct.  -strict-types assumes
> '() to be null from the initialization.  Short of a way to declare
> the type of foobar as (list-of <whatever>) this fails when it's used
> as the initial and correct value of type (list-of <whatever>) with
> zero length.

You should be able to use `the' or `assume' for that purpose.


> What the optimizer should do is to see into the doloop and notice
> the ambiguous type null being refined to a list.

Given that the description of -strict-types is "assume variable do not
change their type" I think the behavior is correct.


> Find attached two more variants.  strcttps2.scm, which convinces
> chicken to do the right thing, ans strcttps2.scm, which fails
> the other way around.

Right, here you initialize the variable's type with list (or pair, I
don't know what's detected) and then possible change it to null while
never checking with null? on the whole list but only on the rest. Looks
fine from what I can tell!

Moritz



reply via email to

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