Re: Language change proposal

From: Sergio Antoy <antoy_at_cs.pdx.edu>
Date: Mon, 23 Dec 1996 08:17:37 -0800

Herbert writes:

> your proposal (restrictions R1 and R2)
> for allowing free variables in the right hand
> side of rules seems to be a good basis for the desired
> generalization.
>
> However, I was a bit confused by your examples.
>
> You seem to be suggesting that the equivalent to
> if-clauses in the current Curry-proposal are
> where-clauses in Haskell.

You are right, indeed I confused guards and where-clauses.
However, after some thinking, I wonder if Curry needs both. Of
course, it may be appropriate to keep both to maximize the
similarity with Haskell, but in the considerations that follow I
ignore this important aspect.

There is a fundamental difference between the operational
semantics of Curry and Haskell. In Haskell, if a term pattern
matches the lhs of a rule, a committment is made to permanently
disqualify pattern matching the term with any other rule lhs.
Thus a guard has the primary role of delaying or preventing this
committment until more information than that of a pattern is
known. In other words, guards may very well fail, but
where-clauses should never fail.

In Curry no committment of this kind is made, i.e., if a term t
unifies with the lhs of a rule r, other distinct rules may be
fired on t regardless of whether r is fired on t. Thus, Curry has
one reason less than Haskell to separate guards and where-clauses.
Furthermore, Curry has one reason more than Haskell to adopt a
single mechanism for guards and where-clauses. A single mechanism
would support local definitions in the guards, too, which I
believe are not supported in Haskell. This is probably a marginal
advantage, but if there are no drawbacks in a adopting single
mechanism, it comes at no cost.

> The current Curry-proposal can be understood as an
> intermediate language where such local definitions
> have been compiled out by some kind of lambda-lifting.

OK. So let's keep these ideas in the backs of our minds until the
time comes for their application, though we should discuss enough
some issues to feel confident that the intermediate language is
appropriate to support the full language that we envision.

> A minor point:
>
> >
> > Var (ti) is contained in Var (l) union Var (sj),
> > for j in 1,...,i-1 R2
> >
>
> Shouldn't this be:
>
> Var (ti) is contained in
> i-1
> Var (l) U U Var (sj),
> j=1 R2
>

Yes, and Happy Holidays to all the members of this list that
celebrate them.

Sergio

--------------------------------
Sergio Antoy
Dept. of Computer Science
Portland State University
P.O.Box 751
Portland, OR 97207
voice +1 (503) 725-3009
fax +1 (503) 725-3211
internet antoy_at_cs.pdx.edu
WWW http://www.cs.pdx.edu/~antoy
--------------------------------
Received on Do Dez 26 1996 - 22:51:03 CET

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