[clean-list] relationship between uniqueness types and single-threaded lambda calculus?

John van Groningen johnvg at cs.ru.nl
Wed May 30 17:47:21 MEST 2007


Edsko de Vries wrote:
>I had a quick read through the paper you mentioned. However, since that
>was the first time I read about the STPLC, I find it hard to compare it
>to uniqueness typing. I agree that one difference is that the example
>they give in the paper:
>
>swap! a i j =
>  let* x = lookup a i
>       y = lookup a j
>  in update! (update! a i y) j x
>
>cannot be typed in Clean. However, I'm not sure if this is due to the
>lack of the "r" mode Instead, I would venture that this is due to the
>absence of a "let*" construct in Clean.  I'm not sure why it isn't there
>actually, and it would be relatively straightforward to add it (I might
>just do that in the system I'm proposing :)

This looks like observation typing using #! (non recursive strict let).
See section 9.4 of the Clean language report.

The swap function could be written as:

swap a i j
	#! x = lookup a i
	#! y = lookup a j
	= update! (update! a i y) j x

>Clean *does* take the
>evaluation order into account in some cases however; in particular, in
>conditionals.

This is similar to what happens for #!.

Kind regards,

John van Groningen


More information about the clean-list mailing list