Higher level built-in strings

Marianne Gagnon auria.mg at gmail.com
Mon Jul 19 16:49:58 PDT 2010


Pragmatically, I seem to have noted that in languages with low level strings, people invariably come up with librairies that provide higher-level strings. C/C++ provided low-level strings only initially, then a not-so-powerful std::string; and we saw QString, wxString, irr::string, BetterString, countless others...

Java, on the other end, provided a powerful high-level String object from the start; and to my knowledge it is used consistently in all Java programs with no other string classes being made.

I do acknowlegde that D arrays are much better than C/C++ arrays. Still, my prediction is that if D chooses to stick to C-style function calls, and does not provide a standard high-level String object, then a myriad of string objects will start popping around. Because lots of people like OOP and don't like C-style calls.

Just my 2c :) I mean be wrong

-- Auria

Walter Bright Wrote:

> Strings in D are deliberately meant to be arrays, not special things. Other 
> languages make them special because they have insufficiently powerful arrays.
> 
> As for indexing by code point, I also believe this is a mistake. It is proposed 
> often, but overlooks:
> 
> 1. most string operations, such as copying and searching, even regular 
> expressions, work just fine using regular indices.
> 
> 2. doing the operations in (1) using code points and having to continually 
> decode the strings would result in disastrously slow code.
> 
> 3. the user can always layer a code point interface over the strings, but going 
> the other way is not so practical.



More information about the Digitalmars-d mailing list