Top 5

Benji Smith dlanguage at benjismith.net
Thu Oct 9 05:46:46 PDT 2008


Robert Fraser wrote:
> Chris R. Miller wrote:
>> Benji Smith wrote:
>>> Chris R. Miller wrote:
>>>> Benji Smith wrote:
>>>>> 4. String processing sucks. Writing code that works transparently 
>>>>> with all three character types and correctly handles all unicode 
>>>>> characters is basically impossible. Or at least it feels 
>>>>> impossible. Trying to support both Phobos and Tango in the same 
>>>>> string-processing routine is a definite no-go. In an ideal world, 
>>>>> string-processing code shouldn't have to be littered with "static 
>>>>> if" all over the place.
>>>>
>>>> How would this be "fixed?"  Hint: don't suggest making strings an 
>>>> object.  We tried that a while back, and it was more or less shot down.
>>>
>>> Well, personally, I'd prefer it if strings were objects.
>>
>> As well for me.  Worked just fine in Java, I don't see why it can't 
>> work here.  Rather, knowing what I know about D and Java, I would tend 
>> to think that a D implementation of a String as an object would be 
>> /more/ powerful than the Java implementation.
>>
>>> But I could accept strings as character arrays if they were actually 
>>> characters arrays.
>>
>> Amen.
> 
> http://www.dprogramming.com/mtext.php
> 
> Nearly as efficient as regular strings & same memory footprint as the 
> type of the lagest character within (i.e. if it contains only ascii, 8 
> bits/char. If it contains things representable in UTF-16, 16 bits a 
> character. If it contains cuneoform, 32 bits per char).

Looks interesting. I've downloaded it. I'll give it a whirl and let you 
know what I think. But, upon first glance, you definitely need some 
example code and a tutorial. Right now, I don't really know where to start.

--benji



More information about the Digitalmars-d mailing list