On Mar 25 2013, Moritz Heidkamp wrote:

Jörg F. Wittenberger <joerg.wittenber...@softeyes.net> 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.

Where would I find "the" respective "assume" to be documented?

(Would the syntax break standard Scheme compatibility?)



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!



_______________________________________________
Chicken-hackers mailing list
Chicken-hackers@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-hackers

Reply via email to