Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: "Robert M. Solovay" <solovay@Math.Berkeley.EDU>
To: skaller <skaller@users.sourceforge.net>
Cc: David Brown <caml-list@davidb.org>,
	Jon Harrop <jon@jdh30.plus.com>, caml-list <caml-list@inria.fr>
Subject: Re: [Caml-list] Polymorphism and the "for" loop
Date: Thu, 21 Oct 2004 19:22:37 -0700 (PDT)	[thread overview]
Message-ID: <Pine.SOL.4.44.0410211921030.29298-100000@blue1> (raw)
In-Reply-To: <1098407993.7584.6.camel@pelican.wigram>

How does one define a function f of type int -> void? I looked in the
OCaml manual and couldn't find any reference to "void". {It is, of course,
a familiar concept in C.}

	--Bob Solovay




On 22 Oct 2004, skaller wrote:

> On Fri, 2004-10-22 at 05:11, David Brown wrote:
> > On Thu, Oct 21, 2004 at 07:50:43PM +0100, Jon Harrop wrote:
>
> > Because its only a warning, not an error.  g is allowed to return any type.
> > It could be argued that the loop expression must be of type unit, then this
> > could also be inferred by type inference.
>
> It can also be argued chosing unit for non-returning function
> is the wrong choice and that correct choice is void.
>
> In particular given
>
> f: unit -> unit
>
> you can write
>
> f ( f () )
>
> which is silly. Given
>
> f: unit -> void
>
> that expression won't type check. The result is to force
> 'commands' with side effects and no return values
> be 'top level' (or at least arguments of for, ';', etc).
>
> This seems to work well in Felix.
>
> --
> John Skaller, mailto:skaller@users.sf.net
> voice: 061-2-9660-0850,
> snail: PO BOX 401 Glebe NSW 2037 Australia
> Checkout the Felix programming language http://felix.sf.net
>
>
>
> -------------------
> To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
> Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
>

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


  reply	other threads:[~2004-10-22  2:22 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-10-21 18:50 Jon Harrop
2004-10-21 19:11 ` David Brown
2004-10-22  1:19   ` skaller
2004-10-22  2:22     ` Robert M. Solovay [this message]
2004-10-22  6:19       ` skaller
2004-10-22  7:38         ` Jon Harrop
2004-10-22  8:06           ` David Brown
2004-10-22  9:39             ` Andreas Rossberg
2004-10-22  8:13           ` William Lovas
2004-10-22  8:17             ` Jon Harrop
2004-10-22 14:02           ` skaller
2004-10-22 14:31             ` David Brown
2004-10-22 17:06         ` Brian Hurt
2004-10-22  4:17     ` William Lovas
2004-10-22  6:42       ` skaller
2004-10-21 19:12 ` Ville-Pertti Keinonen
2004-10-21 19:20   ` Jon Harrop
2004-10-21 19:42     ` Ville-Pertti Keinonen
2004-10-23 11:41 ` Richard Jones
2004-10-23 12:06   ` Matti Jokinen
2004-10-22 14:07 Harrison, John R
2004-10-22 14:45 ` John Carr
2004-10-23 20:58   ` Christophe Raffalli
2004-10-22 14:47 ` Andreas Rossberg
2004-10-22 16:00 Harrison, John R

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.SOL.4.44.0410211921030.29298-100000@blue1 \
    --to=solovay@math.berkeley.edu \
    --cc=caml-list@davidb.org \
    --cc=caml-list@inria.fr \
    --cc=jon@jdh30.plus.com \
    --cc=skaller@users.sourceforge.net \
    /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