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
[Caml-list] Infix operators
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Erik de Castro Lopo <ocaml-erikd@m...>
Subject: [Caml-list] Infix operators
Hi all,

I've got a number of defined types for which I'd like to define
infix operators for addition, subtraction, multiplication etc.

Unfortunately since each type needs is own infix operator I'm
running out of ideas unique operator versions for each type.

Why is it not possible to do something like:

    let ( ++ ) (a:float) (b:float) = a +. b ;;

    let ( ++ ) (a:int) (b:int) = a + b ;;

which with the full type specification should allow the compiler
to figure out which version to use in a given situation.

  Erik de Castro Lopo (Yes it's valid)
"An older MS internal whitepaper from August 2000 on switching
Hotmail, which MS acquired in 1997, from front-end servers
running FreeBSD and back-end database servers running Solaris
to a whole farm running Win2K, reads like a veritable sales
brochure for UNIX"

To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: