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
Custom operators in the revised syntax
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2007-05-11 (14:15)
From: Loup Vaillant <loup.vaillant@g...>
Subject: Re: [Caml-list] Custom operators in the revised syntax
2007/5/11, dmitry grebeniuk <gds-mlsts@moldavcable.com>:
> Shalom, Nicolas.
> NP> Today it's about custom operators. In the original syntax everyone
> NP> knows that's easy to define and use custom operators like ++, -->,
> >>>>, +|, =?=, ... and as many as you want.
>   As for me, the lack of custom infix operators in revised syntax
> is a feature that allows to keep code clean, without any
> "=?=" or "<<+".  The code "(func arg1 arg2)" is imho much
> more readable than "arg1 op arg2" because: 1. function name
> usually says something about the meaning of the function, 2. you
> don't need to remember operator's precedence and associativity
> to understand the code.

I remember a family of languages where (func x y) is the only syntax : Lisp. :)

I tend to agree when one says custom operators are evil. However, when
the default syntax uses operators, the custom ones are a net win : a
wise programmer will use their semantic load carefully (big nums, for
example), and sparsely, so the code is more readable.  An unwise
programmer will make the code unreadable anyway, regardless of the