caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Suggestion for overloaded operators
@ 2002-02-10 13:04 Warp
  2002-02-10 13:35 ` Alain Frisch
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Warp @ 2002-02-10 13:04 UTC (permalink / raw)
  To: OCaml

Helo.
One of missing thing in Ocaml is the possibility to overload the operators
such as + - / * = (by overloading, i mean : defining such operators for
other types than -int- )....
Here's a syntactic proposal to enable this feature :

(a :+ b)
The ':' is here to precise that we're using overloading , and a and b can be
of any type. ( let's say typea and typeb )
The compiler will seek for a function named :
    typea_add_typeb : typea -> typeb -> typer
and use it to implement the :+ operator. ( which have typer as result type )
And so on...

I think such a thing cannot be done with CamlP4 - because it doesn't know
about types - and I know that the ocaml team has lots of things to do , but
I was thinking that can be a quite good feature for futur updates.

Warp

-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2002-02-11  8:36 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-02-10 13:04 [Caml-list] Suggestion for overloaded operators Warp
2002-02-10 13:35 ` Alain Frisch
2002-02-10 13:46   ` Warp
2002-02-10 13:40 ` Bruno Pagano
2002-02-10 13:51   ` Warp
2002-02-10 17:49 ` Tom
2002-02-11  8:36 ` Francois Pottier

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).