Browse thread
Why doesn't ocamlopt detect a missing ; after failwith statement?
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | skaller <skaller@u...> |
| Subject: | Re: [Caml-list] Why doesn't ocamlopt detect a missing ; after failwith statement? |
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