Re: Intended meaning

From: Michael Hanus <mh_at_informatik.uni-kiel.de>
Date: Tue, 30 Oct 2007 17:02:42 +0100

Sergio Antoy wrote:
> A semantics is good and it should be a part of the Report or it
> should be referenced by it. However, an intuitive less formal
> explanation is also quite desirable. I think that a formal
> semantics should go in an appendix, but the language features
> should be presented more or less as they are now. Thus, the
> problem will not go away by adding a formal semantics. There
> should be an attempt to exaplain the behavior in English.

Yes, I agree and thanks for the feedback.

> Note, that if x were shared in (1+x ? zero x where x free) then
> there would be no problem. The current explanation is OK. This
> may be inconsistent with current implementations (and perhaps
> difficult to implement), but it is conceptually simpler. It is
> also more general, since the programmer can code (1+x ? zero y
> where x,y free) if sharing is not intended.

I think that the simple explanation "several occurrences
of the same variable are always shared" needs more context
information, i.e., the sharing is done only in the expression
under evaluation (and not between different disjuncts of a
disjunctive expression). Thus, x is shared in the expression
(1+x ? zero x). However, if x is instantiated by evaluating
(zero x), then the expression (1+x ? zero x) has been reduced
to (zero x), otherwise (zero x) is not evaluated w.r.t.
the current definition of the operational semantics.
Of course, the expression (1+x ? zero x) can be also reduced
to (1+x) but then (1+x) and (zero x) are two independent
expressions without any sharing of x.

> Is there a clear reason why x should NOT be shared across the
> arguments of (?), but must be in any other situation?

Intuitively, sharing must be kept as long as the different
subexpressions belong to one expression. Thus, x is shared
in (1+x ? zero x) as long as you don't evaluate the (?).
However, if you evaluate (?), the complete expression
is reduced to the left OR right expression so that
the connection between both have been dropped.

Best regards,

Michael
_______________________________________________
curry mailing list
curry_at_lists.RWTH-Aachen.DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/curry
Received on Di Okt 30 2007 - 17:04:04 CET

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