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
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Jacques Garrigue <garrigue@k...>
From: Juergen Pfitzenmaier <>

> when defining a lot of variants the following message seems to restrictive:
>    Too many constructors -- maximum is 248 constructors
> What is the reason for this ? Can this limit be pushed higher ?

This is a hard-coded limit, so there is no magical compiler option to
raise it. There can be no more than 248 nonconstant constructors in a
variant type.

However, if your constructors are constant (they have no parameter),
then this is a now corrected bug. See PR#117 in the caml bug tracking
With the corrected version of the compiler, you may use 2^31 constant
constructors independently of the 248 nonconstant ones.

As a temporary workaround you may use polymorphic variants: it should
be possible to use tens of thousands of both constant and nonconstant
constructors in the same type.

Jacques Garrigue      Kyoto University     garrigue at
		<A HREF=>JG</A>