[clean-list] Serious bug in the type system

John van Groningen johnvg at cs.ru.nl
Fri Dec 21 16:20:42 MET 2007


Edsko de Vriew wrote:

>I was working on the background section to my thesis and was exploring how the
>single-threaded polymorphic lambda calculus deals with strict application, and
>how this cannot really be properly dealt with in uniquenes typing or linear
>logic (we need some hacks to make it work). This got me thinking about exactly
>which hacks we need, and it turns out that the mechanism that is used in Clean
>is not good enough! The following program is referentially opaque (not
>referentially transparent) *but passes the typechecker*:
>
>..
>
>  ohoh :: *{#Char} -> *(*{#Char}, {#Char})
>  ohoh arr
>      #! arr` = arr
>      = (update arr 0 'a', arr`)
>...

This is caused by a bug in the compiler. If the result of #! is an
array with strict or unboxed values, the compiler should not treat
this as an observation, but type the expression in the usual way.

I have fixed this bug in the compiler. It no longer types #! expressions
with arrays in the result in a special way.

For unique arrays with unboxed values this may not be necessary, it may be
correct to type these as observers.

Kind regards,

John van Groningen


More information about the clean-list mailing list