> > Can you please share your experience of writing bindings to some C > libraries for ? How it compares to writing > bindings for OCaml? (this is a thread about runtime values > representation, I suppose.) > > This isn't really relevant to this topic, since this discussion is just about ocaml headers, rather than the ocaml C FFI. The FFI would remain largely the same. > Why will anyone ever need more than 200 constructors of a sum type? > (also note the presence of polymorphic variant types.) > I thought so too, but as mentioned in the previous discussion thread (entitled 'Expanding the Float Array Tag'), code generators can easily run out of 200 constructors. However, it's possible that 65,000 constructors is really excessive, in which case some bits can be shifted around. I'd be happy to get some feedback on this. > > random access to this data is never needed > > mkay... :[ > This is only talking about automatic ocaml functions, which work without any type information. Proper ocaml code is typed, so it doesn't need this information. But internal mechanisms such as the GC, marshal module, and polymorphic comparison are 'dumb' in the sense that they're missing all of the crucial type information. For these functions, there needs to be some basic type information within the data structure itself. Currently, floats are stored in their own independent data structure with a 'double_tag' header, or otherwise they're in a 'double_array'. Having some information in the header about internal floats and pointers is much more efficient, but it doesn't need to have random access -- the internal ocaml functions that use this information process the entire data structure at once. Yotam