Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

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: 2007-08-01 (11:37)
From: Tom <tom.primozic@g...>
Subject: Re: [Caml-list] Re: Void type?
On 31/07/07, Brian Hurt <> wrote:
> So how do I use that module and say, in the type system, "I will never
> pass in a b"?  This is where the void type comes in.  I can declare:
> module Myreq = struct
>         type a = whatever;;
>         type b = void;;
> end;;
> module Myexample = Example(Myreq);;
> Note that I can still call function I can call it with an
> empty list, or with a list of as many A's as I want.  But it's impossible
> for me to create a B element.

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

Essentially, it means the same, just less typing.

 - Tom