Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: John Prevost <prevost@maya.com>
To: John Skaller <skaller@maxtal.com.au>
Cc: Pierre Weis <Pierre.Weis@inria.fr>, caml-list@inria.fr
Subject: Re: convincing management to switch to Ocaml
Date: 31 Aug 1999 02:35:03 -0400	[thread overview]
Message-ID: <m3ogfoa25k.fsf@isil.maya.com> (raw)
In-Reply-To: John Skaller's message of "Tue, 31 Aug 1999 15:19:48 +1000"

John Skaller <skaller@maxtal.com.au> writes:

> but the latter doesn't work right if I need the parameters
> to have names.  I tried:
> 
> 	let (f: t2 -> t2 -> t3) x y  = something;;
> 
> and that doesn't seem to work? This shape is important,
> where I have a set of functions of the same type,
> with an abbreviation. There seems to be a problem,
> that the operator -> is overloaded in meaning:
> it means 'returns the type' and also 'has the value'.

Hmm.  I guess this is sort of a bit odd--it would make sense for the
above to work, in terms of how type constraints usually work.  (Maybe
this ought to be changed to be more consistent.)

If you need a workaround, however, the following *will* work:

let (f : t2 -> t2 -> t3) = fun x y -> something

likewise, the following (which doesn't put the types up front) will work:

let f = (fun x y -> something : t2 -> t2 -> t3)

Basically, the "reduced form" of let for functions, namely "let f x y
= var" won't allow you to specify the type of the function as a whole,
only the types of the arguments and the type of the result:

let f (x : t2) (y : t2) = (something : t3)

In some ways, this isn't really a problem--one of the big pieces of
utility in the ML family of languages is that type inference allows
you to leave out such type signatures.  And explicit signatures for
modules takes care of the general case.

So, it's sort of an obscure problem.

John.




  reply	other threads:[~1999-08-31 17:15 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-07-28 14:47 STARYNKEVITCH Basile
1999-07-30  9:00 ` Markus Mottl
1999-08-13 10:32   ` John Skaller
1999-08-25  1:51     ` Frank A. Christoph
1999-08-25  3:50       ` John Skaller
1999-08-25  6:34         ` Frank A. Christoph
1999-08-26 18:36         ` Stefan Monnier
1999-08-29  6:08           ` John Skaller
1999-08-27 10:00         ` Andreas Rossberg
1999-08-28  6:24           ` John Skaller
1999-08-30 15:59             ` Sylvain BOULM'E
1999-08-31  5:50             ` Brian Rogoff
1999-08-28 19:51           ` Dave Mason
1999-08-30 19:05             ` Xavier Leroy
1999-08-30  8:02           ` Pierre Weis
1999-08-30 19:35             ` John Skaller
1999-08-31 17:10               ` Pierre Weis
1999-09-03  6:56                 ` John Skaller
1999-08-31 19:03               ` Stefan Monnier
1999-09-03  7:28                 ` John Skaller
1999-08-31  0:13             ` John Prevost
1999-08-31  5:19               ` John Skaller
1999-08-31  6:35                 ` John Prevost [this message]
1999-09-03  5:42                   ` John Skaller
1999-08-31 16:24           ` Gerard Huet
1999-07-30 14:42 ` John Skaller
1999-07-30 18:49 ` Gerd Stolpmann
1999-07-30 21:30 ` Francois Rouaix
1999-08-12 10:36 ` Reply to: " Jens Olsson
1999-08-16 18:33   ` Chris Tilt
1999-08-12 12:15 ` Frank A. Christoph
1999-08-15  8:14   ` Friedman Roy
  -- strict thread matches above, loose matches on Subject: below --
1999-09-07  7:24 TommyHallgren
     [not found] <John Skaller's message of "Tue, 31 Aug 1999 15:19:48 +1000">

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=m3ogfoa25k.fsf@isil.maya.com \
    --to=prevost@maya.com \
    --cc=Pierre.Weis@inria.fr \
    --cc=caml-list@inria.fr \
    --cc=skaller@maxtal.com.au \
    /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