First Impressions

Derek Parnell derek at psyc.ward
Fri Sep 29 17:16:50 PDT 2006


On Fri, 29 Sep 2006 10:04:57 -0700, Walter Bright wrote:

> Derek Parnell wrote:
>> And is it there yet? I mean, given that a string is just a lump of text, is
>> there any text processing operation that cannot be simply done to a char[]
>> item? I can't think of any but maybe somebody else can.
> 
> I believe it's there. I don't think std::string or java.lang.String have 
> anything over it.

I'm pretty sure that the phobos routines for search and replace only work
for ASCII text. For example, std.string.find(japanesetext, "a") will nearly
always fail to deliver the correct result. It finds the first occurance of
the byte value for the letter 'a' which may well be inside a Japanese
character. It looks for byte-subsets rather than character sub-sets.

>> And if a char[] is just as capable as a std::string, then why not have an
>> official alias in Phobos? Will 'alias char[] string' cause anyone any
>> problems?
> 
> I don't think it'll cause problems, it just seems pointless.

It may very well be pointless for your way of thinking, but your language
is also for people who may not necessarily think in the same manner as
yourself. I, for example, think there is a point to having my code read
like its dealing with strings rather than arrays of characters. I suspect
I'm not alone. We could all write the alias in all our code, but you could
also be helpful and do it for us - like you did with bit/bool.

-- 
Derek Parnell
Melbourne, Australia
"Down with mediocrity!"



More information about the Digitalmars-d mailing list