Browse thread
RE: [Caml-list] F#
-
Robert Fischer
-
Jon Harrop
-
Roland Zumkeller
-
Brian Hurt
-
Jon Harrop
- Brian Hurt
- Fernando Alegre
- skaller
-
Jon Harrop
-
Brian Hurt
-
Roland Zumkeller
-
Jon Harrop
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Fernando Alegre <fernando@c...> |
| Subject: | Re: [Caml-list] Operator overloading |
On Thu, Mar 08, 2007 at 07:40:42PM +0000, Jon Harrop wrote:
> For me, operator overloading is about clarity. In the absence of operator
> overloading, you cannot regain the lost clarity using modules and functors.
I often use the poor man's local operator overloading already built into
the core OCaml:
let result =
let (+) = Vector.add and ( * ) (x:int) (v:Vector.t) = Vector.scalarmul x v
in 3 * a + 2 * b
This makes overloading local and explicit, and at the same time makes
expressions clear. I do not miss implicit overloading.
Fernando