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
Re: [Caml-list] Naming conventions
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2002-05-08 (14:03)
From: Dave Mason <dmason@s...>
Subject: Re: [Caml-list] Naming conventions
For non-OO style Ocaml, I agree that the type signature is usually
enough, although I also often use is_foo or fooP as predicates.

But, the original question was about objects.  In Java there is a
style that is fairly convenient, whereby mutators for objects return
the object itself instead of void (unit).  This allows doing:

    let theLeftFoo = new foo(42) in

as opposed to:

    let theLeftFoo = new foo(42) in

I am undecided whether I think this is a good style or not, but it is
more readable if you like to give meaningful (and hence long) variable
names.  (If I'd used x instead of theLeftFoo, you probably wouldn't
have noticed much difference.)

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