Browse thread
Void type?
[
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: | Chris King <colanderman@g...> |
| Subject: | Re: [Caml-list] Re: Void type? |
On 7/31/07, Richard Jones <rich@annexia.org> wrote:
> The question is, which void type definition do you use?
>
> type void
>
> or
>
> type void = { v: 'a. 'a }
Personally I would use the second. That way, when you come across a
void value (say, in pattern matching a variant), you can take care of
that match case without resorting to "assert false" (whether directly
or via void_elim):
type t = A of int | B of void
match foo with
| A i -> print_int i
| B v -> v.v
It makes me feel all warm & fuzzy inside that one doesn't have to
resort to "assert false" here :)