On Sat, Dec 13, 2008 at 07:47:46PM -0600, Edgar Friendly wrote:
> ExtLib (and thus batteries) uses your unmute (called [inj]) for
> converting a mutable list into the normal immutable list.  The definition:
> 
> external inj : 'a mut_list -> 'a list = "%identity"
> 
> As always, be *very* careful when using this kind of type system voodoo,
> but it can work under certain circumstances.

This is, in principle, unsound. The compiler could (if it were more agressive)
assume that a value of type 'a list is unaffected by a function call, whereas,
if the list is really mutable, it could actually be written to by the call.

With the current ocaml compiler, this might be okay, but I'd be wary of
building this kind of code into a library.

Best regards,

-- 
François Pottier
francois.pott...@inria.fr
http://cristal.inria.fr/~fpottier/

_______________________________________________
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs

Reply via email to