From: Xavier Leroy <Xavier.Leroy@inria.fr>
To: Juergen Pfitzenmaier <pfitzen@informatik.uni-tuebingen.de>,
caml-list@inria.fr
Subject: Re: too many constructors
Date: Fri, 30 Jun 2000 15:15:10 +0200 [thread overview]
Message-ID: <20000630151510.42620@pauillac.inria.fr> (raw)
In-Reply-To: <200006281716.TAA02282@sunstroke.informatik.uni-tuebingen.de>; from Juergen Pfitzenmaier on Wed, Jun 28, 2000 at 07:16:45PM +0200
> 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 ?
Actually, the limit is 248 non-constant constructors. The reason is
that the "tag" that identifies a non-constant constructor is stored in
a 8-bit field in the block header, and some values for this "tag"
field are reserved by the runtime system, leaving only 248 tags for
non-constant constructors.
As for constant constructors, these are represented by integers, so
there is essentially no limit.
This said, there is a small bug in the compiler: it limits the total
number of constructors to 248, instead of the number of non-constant
constructors. This bug was recently reported to us, and a patch for
OCaml 3.00 is included below.
- Xavier Leroy
Index: csl/typing/typedecl.ml
diff -c csl/typing/typedecl.ml:1.36 csl/typing/typedecl.ml:1.37
*** csl/typing/typedecl.ml:1.36 Tue Mar 21 15:43:24 2000
--- csl/typing/typedecl.ml Mon May 22 10:24:05 2000
***************
*** 10,16 ****
(* *)
(***********************************************************************)
! (* $Id: typedecl.ml,v 1.36 2000/03/21 14:43:24 xleroy Exp $ *)
(**** Typing of type definitions ****)
--- 10,16 ----
(* *)
(***********************************************************************)
! (* $Id: typedecl.ml,v 1.37 2000/05/22 08:24:05 xleroy Exp $ *)
(**** Typing of type definitions ****)
***************
*** 141,147 ****
raise(Error(sdecl.ptype_loc, Duplicate_constructor name));
all_constrs := StringSet.add name !all_constrs)
cstrs;
! if List.length cstrs > Config.max_tag then
raise(Error(sdecl.ptype_loc, Too_many_constructors));
Type_variant(List.map
(fun (name, args) ->
--- 141,148 ----
raise(Error(sdecl.ptype_loc, Duplicate_constructor name));
all_constrs := StringSet.add name !all_constrs)
cstrs;
! if List.length (List.filter (fun (name, args) -> args <> []) cstrs)
! > Config.max_tag then
raise(Error(sdecl.ptype_loc, Too_many_constructors));
Type_variant(List.map
(fun (name, args) ->
***************
*** 355,361 ****
| Duplicate_constructor s ->
fprintf ppf "Two constructors are named %s" s
| Too_many_constructors ->
! fprintf ppf "Too many constructors -- maximum is %i constructors"
Config.max_tag
| Duplicate_label s ->
fprintf ppf "Two labels are named %s" s
--- 356,363 ----
| Duplicate_constructor s ->
fprintf ppf "Two constructors are named %s" s
| Too_many_constructors ->
! fprintf ppf "Too many non-constant constructors -- \
! maximum is %i non-constant constructors"
Config.max_tag
| Duplicate_label s ->
fprintf ppf "Two labels are named %s" s
prev parent reply other threads:[~2000-06-30 15:36 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-06-28 17:16 Juergen Pfitzenmaier
2000-06-30 0:40 ` Jacques Garrigue
2000-06-30 13:15 ` Xavier Leroy [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20000630151510.42620@pauillac.inria.fr \
--to=xavier.leroy@inria.fr \
--cc=caml-list@inria.fr \
--cc=pfitzen@informatik.uni-tuebingen.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox