Browse thread
how to coerce expression type?
- Dwight VandenBerghe
[
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: | 1998-12-23 (15:03) |
From: | Dwight VandenBerghe <dwight@p...> |
Subject: | how to coerce expression type? |
I am converting older ocaml code to version 2.01, and find that many expressions that passed through the previous compilers fine now exhibit warning errors due to not being of unit type. This happens when I evaluate an expression for its side effects (the horror, the horror). Here's an example: let is_in_table table key = try Hashtbl.find table key; true with Not_found -> false;; I don't want the result back from the lookup, I just want to know if the key was present. So how do I "cast" the find operation to unit, to quiet the warnings? I've tried everything I can think of, things like (Hashtbl.find table key) : () but have not yet hit upon the magic incantation. Thank you. Dwight