English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
[Caml-list] petty complaints
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2001-04-09 (16:29)
From: Pierre Weis <Pierre.Weis@i...>
Subject: Re: [Caml-list] petty complaints
> On Sun, Apr 01, 2001 at 09:26:59PM -0700, Brian Rogoff wrote:
> >     Another unrelated trifling question concerns the syntax of numerical 
> > literals. 
> Now that the spring cleaning for OCaml's syntax (floats, labels,
> constructors) is in full swing, here is my wish:  Haskell allows to
> use any identifier as a binary operator when it is placed in
> backquotes:  x `plus` y.  These operators are often more readable than
> the classic infix operator symbols.  These terms have no associativity
> and a low precedence, thus forcing to use parentheses.  An
> implementation would only affect the lexer and should not be too hard. 
> Would other people like this feature, too?
> -- Christian
> -- 
> Christian Lindig          Harvard University - DEAS
> lindig@eecs.harvard.edu   33 Oxford St, MD 242, Cambridge MA 02138
> phone: +1 (617) 496-7157  http://www.eecs.harvard.edu/~lindig/
> -------------------
> To unsubscribe, mail caml-list-request@inria.fr.  Archives: http://caml.inria.fr

For simplicity, this would require that polymorphic variant
constructors obey to the rule `UIDENT (meaning that a polymorphic
variant constructors must start with an upper case letter). Otherwise
we would depend on the ``longest match'' rule or careful use of
spaces, as exemplify by:

        Objective Caml version 3.01

# (fun _ _ -> 1) `poi`gee;;
- : int = 1

On the other hand, the new infix identifiers would start by a lower
case letter (as usual value identifiers).

As soon as those simple problems have been checked and resolved, I
think this notation is a reasonable way to have infix identifiers in
the spirit of the current syntax, i.e. with no infix declarations,
just based on lexical analysis.

Hope this helps,

Pierre Weis

INRIA, Projet Cristal, Pierre.Weis@inria.fr, http://pauillac.inria.fr/~weis/

To unsubscribe, mail caml-list-request@inria.fr.  Archives: http://caml.inria.fr