Re: set functions and weak encapsulation

From: Wolfgang Lux <wlux_at_uni-muenster.de>
Date: Mon, 12 Mar 2012 11:14:44 +0100

Sebastian Fischer wrote:

>> Even if this were possible (in MCC it wouldn't work at present), it would look like a bad idea to me because that would make code using your proposed values function very fragile under program transformations.
>
> More than with 'findall' in the current MCC? There we also have
>
> findall (\y -> (0?1) =:= y) = [0,1]
>
> but
>
> let x = 0?1 in findall (\y -> x =:= y) = [0] ? [1]
>
> which looks just as fragile under program transformations. The
> difference is that in this case the example differ according to
> sharing under a lambda which one might argue (and you probably do) is
> an important difference.

Indeed. Moving sharing into or out of lambda abstractions is not a valid transformation in Curry in general, as it can change the set of solutions of a program. Adding or removing let expressions otherwise does not change that set. This may not be much of a problem for direct applications of the values functions. But what when values is used in higher order applications, e.g., map values or even more interesting id values (an optimizing compiler might easily transform id values into values alone)?

Cheers
Wolfgang


_______________________________________________
curry mailing list
curry_at_lists.RWTH-Aachen.DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/curry
Received on Mo Mär 12 2012 - 11:50:45 CET

This archive was generated by hypermail 2.3.0 : Do Jun 20 2024 - 07:15:12 CEST