[clean-list] undefined strictness

erik.zuurbier@tiscali.nl erik.zuurbier@tiscali.nl
Wed, 14 Jul 2004 12:16:34 +0200


Bernie Pope wrote: 
>> myfun :: Int Real -> String
>> myfun x y = undef
>> 
>> Then when I call the compiler and watch the Types window, I see:
>> 
>> myfun :: !Int !Real -> {#Char}
>> 
>> My question is: how can it derive the strictness? I expected the arguments
>> would be considered non-strict.
>
[...]
>It appears that myfun always diverges, no matter what arguments
>you give it
[...]
>
>You can also take an operational point of view. The strict annotation
>says to the compiler that it can go ahead and evaluate the arguments
>of an application _before_ the body. In this case it won't matter if
>the evaluation of an argument diverges because the body is going to
>diverge anyway.

Great, I hadn't realised that. I had always assumed that undef - since it
needs to be imported - would be treated
as just another constant and that the strictness analyser could have no
particular knowledge about its divergence.
Apparently it does.

Thank you very much, Bernie.
Will Clean ever stop amazing me?

By the way, if you don't import undef, Clean proclaims a Zen like truth:
undef undefined


_____________________________________________________________________

Bent u toe aan sneller en goedkoper internet? 
Ga dan naar http://adsl.tiscali.nl