Closed dinosaure closed 4 years ago
Would it make sense to just have one function with an optional ?shared
argument if no allocation is desired?
as mentioned in #11, I'm rather sceptical this is a good idea. The potential error of shared
not being big enough needs to be handled (in here, it is an invalid_arg
-- which is slightly in contrast to design goals "no leaking exceptions"). what should the semantics of shared
being too big be - should the remaining bytes be cleared out with 0, or remain as they are?
FWIW, if allocation is an issue due to bigarrays, I suggest to put this on hold for post-cstruct-5, which has this very nice interface with an abstract type t
that allows us to implement cstruct in terms of strings/bytes (which should to my knowledge behave much smoother with the ocaml runtime system). to me, such an API with sharing mutable data structures in mind are worrying.
See #11