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] failwith, raise and type inference
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2004-04-02 (20:28)
From: Pierre Weis <pierre.weis@i...>
Subject: Re: [Caml-list] failwith, raise and type inference
> Admitedly caml syntax is not very  beginner friendly.
> But the observed parsing has some internal logics.
> On usualy understand that  f x + y is in fact  (f x) + y
> But here, with failwith being a ``special'' function and ^ a ``special''
> operator, well...

That could be part of the problem: failwith is not ``special'' nor is ^,
hence the regular treatment of f x ^ y as (f x) ^ y and failwith x ^ y
as (failwith x) ^ y.

Operator precedence in Caml has been carefully crafted, you should
have a look at the programming guide lines that gives some hints on the
internal logics of some parts of the parsing, in the section

   When to use parentheses within an expression

Best regards,

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
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners