Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Brian Rogoff <bpr@best.com>
To: caml-list@inria.fr
Subject: Re: Overloading
Date: Tue, 10 Mar 1998 13:35:29 -0800 (PST)	[thread overview]
Message-ID: <Pine.BSF.3.96.980310131044.20784A-100000@shell5.ba.best.com> (raw)
In-Reply-To: <199803101942.OAA09854@wagga.cs.umass.edu>



On Tue, 10 Mar 1998, Adam P. Jenkins wrote:
> Brian Rogoff writes:
>  > Hi Caml'ers,
>  > 	One of the things I miss the most when I'm working in Caml is 
>  > overloading. There are numerous situations, such as arithmetic, linear 
>  > algebra (where I may want multiplication between scalars, vectors, 
>  > matrices, and higher order tensors), I/O (read/write/open), etc. where 
>  > it is IMO the "right thing". Are there any plans to add some form of 
>  > overloading to Caml in the future? I know that the Haskell folks plan to 
>  > remove the single parameter restriction in type classes and gain more 
>  > expressiveness in these areas, but none of the ML family of languages 
>  > I know of support any overloading.
>  > 
>  > 	My experience with overloading in Ada is almost entirely positive.
>  > 
> 
> I too have missed overloading in ML/Caml.  However, it seems to me
> that function overloading is opposed to type inference; you can't have
> both at the same time without too many explicit casts, which destroys
> the point of function overloading.

Yes, I know the marriage of the type inference and overloading is a
difficult one. 

> Are there any languages which have
> both automatic type inference and function overloading?
> 
> Adam

Haskell has some limited ad-hoc polymorphism via its type classes, and 
there was some work at adding a form of ad-hoc polymorphism to Caml. It is 
on the Caml page, look for "extensional" polymorphism. I haven't read it
yet. Perhaps some of the Caml implementors can comment on what it
describes. Also under Francois Rouaix's page is a description of "Alcool", 
which has another approach to overloading in an ML like language.

C++ (which has overloading) supports a limited form of type inference for 
templated functions. There was a proposal to add something similar to Ada 
in an old Tri-Ada proceedings. It is usually called "automatic instantiation"
or something similar in those communities. 

In response to Frank Christoph, I am using O'Caml. What I really want in 
this case is overloading, not OO. I think the reasons for this desire and 
the arguments for overloading are known, so I won't repeat them unless 
someone wants me to. I have seen O'Labl, but since I use Windows NT at 
home I haven't used it yet (when I get Linux that will change ;-). It
looks very promising, and I also miss named parameters from Ada, but
still, it isn't quite what I want.

-- Brian







  reply	other threads:[~1998-03-11  8:24 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-03-09 21:02 Overloading Brian Rogoff
1998-03-10 19:42 ` Overloading Adam P. Jenkins
1998-03-10 21:35   ` Brian Rogoff [this message]
1998-03-12 17:29     ` Overloading Jun P. Furuse
1998-03-13  8:56       ` [LONG] Overloading Francois Rouaix
1998-03-10 20:28 Overloading Frank A. Christoph

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.BSF.3.96.980310131044.20784A-100000@shell5.ba.best.com \
    --to=bpr@best.com \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox