There is no abstraction in C++, you can always poke around the memory layout of what you are given, and change your behavior depending on that.
For example, let us say you have a module satisfying this signature:
module M : sig
type sorted
val import : int array -> sorted
end = struct
type sorted = int array
let import = Array.sort
end
In OCaml, if you have a value of type `sorted`, you
know it's indeed sorted. In C++, as soon any code external to the module had an handle on it, you don't know! It could have modified the array behind your back, since it can look directly at the definition, or worse, poke in the memory layout.
For example, let us say you have a module satisfying this signature:
In OCaml, if you have a value of type `sorted`, you know it's indeed sorted. In C++, as soon any code external to the module had an handle on it, you don't know! It could have modified the array behind your back, since it can look directly at the definition, or worse, poke in the memory layout.