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: Jörg F . Wittenberger
Subject: Re: [Chicken-hackers] testcase -strict-types
Date: 31 Mar 2013 19:49:05 +0200

On Mar 30 2013, Felix wrote:

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.

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

... and this is exactly what the normal type-analysis is doing.  But
that refinement generalizes the type of a variable to cover all uses
of it, and that makes it very difficult to figure out the most
specific type, in particular when the type changes during the lifetime
of a variable. List-types create more problems as this example
shows. So I can only keep suggesting not to use strict-types but in
special situations.

After I understood that the type analysis would be troubled
and there's the (the type init) alternative, I'm actually ok
with the situation as it is.

I've got around one warning per 2000 lines of code; easily
tagged with the intended type.  (That is, if there where not
this problem to trick the compiler into accepting the init value.)

Otherwise I love it for being stricter a check.  Dunno so far
how much effect it actually has as an optimization.

/Jörg




...........



reply via email to

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