Version française
Home     About     Download     Resources     Contact us    
Browse thread
Void type?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Markus Mottl <markus.mottl@g...>
Subject: Re: [Caml-list] Re: Void type?
On 8/1/07, Tom <tom.primozic@gmail.com> wrote:
> I am still not convinced about the usability of the void type... Why simply
> not declare type b as abstract?
>
> module Myreq = struct
>         type a = whatever
>         type b
> end
>
> Essentially, it means the same, just less typing.

Less typing in the type definition, but more typing handling a
function or match branch that makes use of a value of type b.  You'd
either have to raise an exception there, or do something unsafe.  The
"void"-solution is much cleaner.

Regards,
Markus

-- 
Markus Mottl        http://www.ocaml.info        markus.mottl@gmail.com