Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[oliver: Re: [Caml-list] Strings as arrays or lists...]
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2003-03-03 (21:32)
From: Basile STARYNKEVITCH <basile@s...>
Subject: Re: [oliver: Re: [Caml-list] Strings as arrays or lists...]
>>>>> "William" == William Lovas <> writes:


    William> You keep skirting around this question by saying that
    William> what he really wants is extensional polymorphism, but
    William> overloading is not the only way to get the same syntax
    William> for strings and arrays.  Another way is to have them
    William> simply *be the same thing*.  That is, is there any deep
    William> reason not to do

    William>     type string = char array

    William> right up front, and inherit all the Array module's
    William> functions?  We could still keep a String library with all
    William> string-specific functions in it, but we'd gain a
    William> unification of many function implementations, and the
    William> same notation for random access to boot.

It could be interesting, but I guess that adding such specifical
implementation may seriously increase the compiler complexity and
could even explode (or at least seriously increase) the generated

    William> You mentioned that strings are packed -- meaning that
    William> they're more efficient than generic arrays?  But doesn't
    William> O'Caml already have compiler magic for making float
    William> arrays fast and efficient?  Why not just do the same
    William> thing for char arrays?

I do share the wish but would tend to believe that it is programmer
time consuming. For example, grep-ing (case insensitively) for float
in the compilers gives a lot of occurrences.

Perhaps a long term dream might be to be able to provide specific
implementations for different instances of variable types,
e.g. different implementations for sets of float versus sets of object

Regarding strings I would tend to think that separating mutable
strings from read-only strings could be useful, and 16bits or 32bits
unicode strings might be desirable.

Does any one have ideas on how to implement localisation &
internationalisation of applications?


email: basile<at>starynkevitch<dot>net 
alias: basile<at>tunes<dot>org 
8, rue de la Faïencerie, 92340 Bourg La Reine, France

To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: