caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: skaller <skaller@users.sourceforge.net>
To: Hendrik Tews <tews@tcs.inf.tu-dresden.de>
Cc: caml-list <caml-list@inria.fr>
Subject: Re: [Caml-list] Why doesn't ocamlopt detect a missing ; after failwith statement?
Date: 27 Nov 2004 14:47:42 +1100	[thread overview]
Message-ID: <1101527262.9291.572.camel@pelican.wigram> (raw)
In-Reply-To: <rlllcomep8.fsf@ithif59.inf.tu-dresden.de>

On Sat, 2004-11-27 at 09:24, Hendrik Tews wrote:
> Jacques Garrigue <garrigue@math.nagoya-u.ac.jp> writes:
> 
>    Note that void in C is definitely not zero. You cannot have variables
> 
> C++ standard, 3.9.1.9: The void type has an empty set of values. ...
> 
> So I would say void is zero. On the other side you have functions
> returning void. Therefore I would conclude that the type theory
> of C++ is unsound.

I'm not sure I quite understand (not that I disagree with 
the conclusion..)

void in C++ is initial. However, this function:

	int f();

is NOT a function

	void -> int

because in C/C++ you have a list of arguments:

	g(a,b,c)

If you construe the list as a product, so that the function

	int g(int,float,long)

has type

	int * float * long -> int

then you must construe the type of f as

	unit -> int

since the product of an empty list is unit, and NOT void.
The notation for application:

	f ()

even looks like f is being applied to an Ocaml empty tuple :)

In particular in C++ you will note that this does NOT
type correctly:

	void f();
	f( f() );

because the type of f() is void, and the type of the argument
is actually unit.

This means C/C++ has stronger typing in this respect
than Ocaml :)

-- 
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




  reply	other threads:[~2004-11-27  3:47 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-11-25 20:46 Richard Jones
2004-11-25 21:14 ` [Caml-list] " Nicolas Cannasse
2004-11-26  0:11   ` skaller
2004-11-26  0:44     ` Jacques Garrigue
2004-11-26  3:08       ` skaller
2004-11-26  5:25         ` Jacques Garrigue
2004-11-26  7:08           ` Nicolas Cannasse
2004-11-26 14:42             ` Jacques Garrigue
2004-11-26 17:01               ` Alain Frisch
2004-11-26 19:36             ` Michal Moskal
2004-11-26 17:01           ` Damien Doligez
2004-11-29  0:40             ` Jacques Garrigue
2004-11-29 11:07               ` [Caml-list] Why doesn't ocamlopt detect a missing ; afterfailwith statement? Frederic van der Plancke
2004-11-29 11:43                 ` Jacques Garrigue
2004-11-29 11:27               ` Frederic van der Plancke
2004-11-26 22:24           ` [Caml-list] Why doesn't ocamlopt detect a missing ; after failwith statement? Hendrik Tews
2004-11-27  3:47             ` skaller [this message]
2004-11-29  0:01             ` Jacques Garrigue
2004-11-29  7:52               ` Marcin 'Qrczak' Kowalczyk
2004-11-26  3:58       ` skaller
2004-11-26 19:16     ` Brian Hurt
2004-11-26  9:01   ` Richard Jones
2004-11-26  9:56     ` skaller
2004-11-26 13:32     ` Ville-Pertti Keinonen

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=1101527262.9291.572.camel@pelican.wigram \
    --to=skaller@users.sourceforge.net \
    --cc=caml-list@inria.fr \
    --cc=tews@tcs.inf.tu-dresden.de \
    /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;
as well as URLs for NNTP newsgroup(s).