Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: skaller <skaller@users.sourceforge.net>
To: David Brown <caml-list@davidb.org>
Cc: Jon Harrop <jon@jdh30.plus.com>, caml-list <caml-list@inria.fr>
Subject: Re: [Caml-list] Polymorphism and the "for" loop
Date: 22 Oct 2004 11:19:53 +1000	[thread overview]
Message-ID: <1098407993.7584.6.camel@pelican.wigram> (raw)
In-Reply-To: <20041021191156.GA17933@old.davidb.org>

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


  reply	other threads:[~2004-10-22  1:20 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 [this message]
2004-10-22  2:22     ` Robert M. Solovay
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=1098407993.7584.6.camel@pelican.wigram \
    --to=skaller@users.sourceforge.net \
    --cc=caml-list@davidb.org \
    --cc=caml-list@inria.fr \
    --cc=jon@jdh30.plus.com \
    /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