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: 25 Mar 2013 09:58:32 +0100

On Mar 24 2013, Moritz Heidkamp wrote:

Peter Bex <address@hidden> writes:
As I understand it, strict-types declares variables to never change
their types.  So once it's looked at the initial declaration of the
variable, it assigns it a type of null, and then it can never change.

    -strict-types assume variable do not change their type

The set! would change the type from NULL to LIST (or maybe PAIR),
invalidating that assumption.

Ah, very good, that should explain it. I somehow had it remembered as
"assume functions are always called with correctly typed arguments" or
something. Should have RTFM :-)

I guess the problem is something different.

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.


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


Best

/Jörg





......

Attachment: strcttps2.scm
Description: strcttps2.scm

Attachment: strcttps3.scm
Description: strcttps3.scm


reply via email to

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