Browse thread
[oliver: Re: [Caml-list] Strings as arrays or lists...]
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Basile STARYNKEVITCH <basile@s...> |
| Subject: | Re: [oliver: Re: [Caml-list] Strings as arrays or lists...] |
>>>>> "William" == William Lovas <wlovas@stwing.upenn.edu> 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
code.
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
instances.
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?
--
Basile STARYNKEVITCH http://starynkevitch.net/Basile/
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 caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners