Re: Slight change of the Curry syntax

From: Michael Hanus <mh_at_informatik.uni-kiel.de>
Date: Tue, 02 Sep 2003 09:39:39 +0200

Wolfgang Lux wrote:
> > Poroposal 2:
> > Qualifications of the operator "." are syntactically not allowed.
>
> I must admit that it dislike this kind of special hacks. In fact,
> this ``fix'' seems to have some more consequences. For instance, in
> Haskell and in the Muenster Curry compiler it is possible to use the
> following declaration in order to make only the qualified names of all
> prelude entities visible:
>
> import qualified prelude
>
> I tend to make use of this in order to check for prelude dependencies
> in my programs and also to test/write replacements for prelude
> functions. As it stands, your proposal will make the operator .
> inaccessible after this import declaration. (It is possible, but not
> always reasonable, to add a declaration import prelude((.)) to the
> program; e.g., if you want to provide a prelude replacement which
> implements some kind of tracing, or whatever, on top of the prelude
> functions.)

I must admit that I was not so happy with this hack and your
arguments are convincing. It is better to require some better
layout (spacing) rather than making things inaccessible.

> Also note that there are other places where a space is needed in order
> to avoid the interpretation as qualified name, e.g. you cannot write
>
> putStr.show
>
> to denote the expression which is equivalent to the print function, but
> have to add (at least) one space either before or after the dot.
>
> BTW, in Haskell this problem is leveraged by the fact that module names
> have to start with an upper case letter. If we were going to adopt this
> convention, the problem would go away -- at least as long as you use
> lower case variable names. Furthermore, putStr.show becomes valid (for
> people who prefer it), but not Just.id.

Exactly, and since there is this asymmetry even with the
upper/lowercase requirement of Haskell, I am not in favor
to restrict names to this requirement but require to write
spaces before the dot if there is an identifier in front.
Thus, the new proposal is to interpret a name (module identifier)
directly followed by a dot and a name (or operator) always as
a qualified identifier (as in the current syntax definition).
Thus, the arithmetic sequence example must be written as

f i = [i ..]

and one can still qualify the operator "." as "prelude..".

Ok?

Best regards,

Michael

_______________________________________________
curry mailing list
curry_at_lists.RWTH-Aachen.DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/curry
Received on Di Sep 02 2003 - 09:41:14 CEST

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