[LLVMdev] improving the ocaml binding's type safety
gordonhenriksen at mac.com
Sat Mar 15 19:33:59 PDT 2008
After some experimentation, I'd prefer the closed system. LLVM has
some type peculiarities like the commonality between CallInst and
InvokeInst. I find that the closed type system lets me express such
constraints more naturally. Expressing these constraints explicitly in
the open system involves annotating the C++ class hierarchy with extra
variants which are unnecessary in the closed model.
Please use 'a Llvm.ty for Type and 'a Llvm.v for Value to save typing.
These choices avoid conflicting with the common type binding t and the
language keyword val, but promote these important types to the type
names into the Llvm module (likely open'd) for brevity's sake.
I don't have a better suggestion than just naming the variant sum
types Llvm.ll_____. I considered some other options, but decided I'm
not fond of them in practice.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the llvm-dev