search for: make_value

Displaying 2 results from an estimated 2 matches for "make_value".

2008 Mar 15
4
[LLVMdev] improving the ocaml binding's type safety
...ous that it'll match, but won't it also match `Foo? Yes it will. We'll work around this by making the type 't' abstract. Then, only our module can create values of it. We'll provide helper functions to create llvalues and llfunctions, which will preserve our invariants: val make_value : unit -> llvalue t val make_function : unit -> llfunction t Here's the full example: foo.mli: type 'a t type llvalue = [ `Value ] type llfunction = [ llvalue | `Function ] val use_value : [> `Value] t -> unit val use_function : [> `Function] t -> unit val make_value...
2008 Mar 15
0
[LLVMdev] improving the ocaml binding's type safety
...tively painlessly for Type. > Here's the full example: > > foo.mli: > type 'a t > type llvalue = [ `Value ] > type llfunction = [ llvalue | `Function ] > > val use_value : [> `Value] t -> unit > val use_function : [> `Function] t -> unit > > val make_value : unit -> llvalue t > val make_function : unit -> llfunction t > > Does this sound like it could work, or am I missing something? I think your sum types are incorrect here. Value is abstract; I think you want to say something like: type llglobal = [ `GlobalVariable | `Function |...