Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

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: -- (:)
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 Archives:
Bug reports: FAQ:
Beginner's list: