Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
UsingPolymorphic Variants
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2005-10-02 (00:06)
From: Christian Stork <cstork@i...>
Subject: UsingPolymorphic Variants
Basic Question:  

    Why aren't polymorphic variants coerced by default?

My Situation:

I am automatically generating some code that uses polymorphic variants
extensively.  The inferred types are very complicated.  Unfortunatly, at
some points in my code coercions are needed for it to compile.  Since I
don't have the types available when I generate the code (and I don't
think it's possible to refer to inferred types in coercions) I can't
coerce explicitly.  I'd like to be able to say something like:

    ... f (x: type_of_x :> type_expected_by_f) ...

Anyway, that's why I'm wondering why the compiler doesn't automatically
coerce or, at least, offer a switch with this functionality.

Thanks for your time,

Chris Stork   <>  Support!  <>
OpenPGP fingerprint:  B08B 602C C806 C492 D069  021E 41F3 8C8D 50F9 CA2F