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: Tom <tom.primozic@g...>
Subject: Re: [Caml-list] Re: Void type?
On 31/07/07, Brian Hurt <bhurt@spnz.org> 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 Myexample.foo- 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
end

Essentially, it means the same, just less typing.

 - Tom