Re: Local pattern declarations in Curry

From: Michael Hanus <hanus_at_informatik.rwth-aachen.de>
Date: Tue, 10 Nov 1998 17:44:45 +0100

Herbert Kuchen wrote:
> Thus, we suggest the following alternative:
>
> 0-ary functions are treated like variables, i.e. via
> sharing. This would avoid the above strange behaviour.
> As far as we can see, non-deterministic nullary functions
> are rarely useful in practice, and in the few cases where one
> would really like to have them (with a "non-sharing-behaviour"),
> one could instead use (e.g.) a unary function
> with a dummy argument.

Thanks for your alternative solution which sounds reasonable.
However, I must admit that I do not fully understand its
consequences. Since the semantic foundation of functional
logic languages is usually based on viewing a program as
a set of function definitions (without local definitions),
I think that all syntactic sugar which we define for Curry
must be finally mapped into a (flat) set of function
definitions. This means that local definitions are lifted
into global ones. During this lifting process, arguments
might be added to local functions so that the arity is changed.
For instance, consider the following definition:

f x = g xs where xs = x:xs

By lifting, we obtain the following global function definitions:

f x = g (xs x)
xs x = x:(xs x)

Now, the originally 0-ary function xs has been transformed into
a function with one argument. Following your proposal, a programmer
might think that xs is shared while actually it is not after
the transformation. In my opinion, this destroys the "fool safeness".

Best regards,

Michael
Received on Di Nov 10 1998 - 17:48:00 CET

This archive was generated by hypermail 2.3.0 : Do Feb 01 2024 - 07:15:05 CET