- Contemporary messages sorted: [ by date ] [ by thread ] [ by subject ] [ by author ] [ by messages with attachments ]

From: Michael Hanus <hanus_at_informatik.rwth-aachen.de>

Date: Tue, 1 Dec 1998 15:35:37 +0100

Dear Wolfgang,

thanks for your interesting example. It shows that one has

to be careful if there is too much syntactic sugar.

My initial motivation for the remark "a defining equation f = g

between functions will be interpreted in Curry as syntactic sugar

for the corresponding defining equation f x = g x on base types"

was to express that the semantics of Curry is not based on

higher-order rewriting which might complicate things.

Thus, I assumed that this kind of desugaring is done

after lambda lifting. It might be interesting to note

that Haskell has also surprisingly restrictions.

For instance, the program

f x = 1

f x = 2

is a valid Haskell program, whereas the version

f = \x->1

f = \x->2

seems to be invalid (although Hugs accepts currently both).

Your remark reminds me that I wanted to suggest a further

restriction for local pattern definitions in Curry which solves

these problems:

All variables occurring in lhs patterns in some let/where

should occur at most once in a lhs of a local pattern declaration.

This restriction would forbid programs like

f x = coin where coin = 1

coin = 2

and also your functions f1,f2,f3.

Do you agree or is this too restrictive?

Michael

Received on Di Dez 01 1998 - 15:39:00 CET

Date: Tue, 1 Dec 1998 15:35:37 +0100

Dear Wolfgang,

thanks for your interesting example. It shows that one has

to be careful if there is too much syntactic sugar.

My initial motivation for the remark "a defining equation f = g

between functions will be interpreted in Curry as syntactic sugar

for the corresponding defining equation f x = g x on base types"

was to express that the semantics of Curry is not based on

higher-order rewriting which might complicate things.

Thus, I assumed that this kind of desugaring is done

after lambda lifting. It might be interesting to note

that Haskell has also surprisingly restrictions.

For instance, the program

f x = 1

f x = 2

is a valid Haskell program, whereas the version

f = \x->1

f = \x->2

seems to be invalid (although Hugs accepts currently both).

Your remark reminds me that I wanted to suggest a further

restriction for local pattern definitions in Curry which solves

these problems:

All variables occurring in lhs patterns in some let/where

should occur at most once in a lhs of a local pattern declaration.

This restriction would forbid programs like

f x = coin where coin = 1

coin = 2

and also your functions f1,f2,f3.

Do you agree or is this too restrictive?

Michael

Received on Di Dez 01 1998 - 15:39:00 CET

*
This archive was generated by hypermail 2.3.0
: So Sep 20 2020 - 07:15:03 CEST
*