I agree, it’d be nice to have that in the stdlib.
Besides, I think it should live in the stdlib, because I believe it’s impossible to write a good vector implementation without a bit of unsafe Obj
to manage the uninitialized part of the array. (I don’t like the requirement to provide a dummy value, it’s a strictly inferior API that is found in no other language (that I know of)).
Arrays in OCaml are already magical; why not dynamic arrays? Even in rust they’re somewhat magical as they concentrate a lot of unsafe
blocks. People modifying the compiler and breaking the (tiny) amount of required Obj
can update the implementation as they go.