9bec255 remove the Obj.magic from the string.ml implementation

Authored and Committed by Gabriel Scherer 9 years ago
    remove the Obj.magic from the string.ml implementation
    
    It is important not to assume that String.t and Bytes.t will always
    share the same representation. Using Obj.magic to convert between
    functions would give a very bad example to users considering
    a migration, which are very quick to imitate any moral turpitude found
    in the standard library.
    
    An unfortunate consequence of the change is the duplication of
    String.concat code; other designs would be possible to share more
    implementation details between Bytes and String (eg. defined
    factorized operations on both in a shared internal module), but if we
    consider that String representation may evolve in the future this
    coincidence of implementation is really a temporary coindence rather
    than an definitive duplication.
    
    I checked that all the small functions introduced are marked as
    inlinable. In the case of coercions like this, we could even have the
    compiler recognize eta-expansions of the identity function and turn
    them into simple rebindings.
    
    git-svn-id: http://caml.inria.fr/svn/ocaml/version/4.02@15061 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
    
        
file modified
+66 -25