Why Strings as Classes?

BCS ao at pathlink.com
Mon Aug 25 17:50:34 PDT 2008


Reply to Benji,

> BCS wrote:
> 
>> Reply to Benji,
>> 
>>> BCS wrote:
>>> 
>>>> Ditto, D is a *systems language* It's *supposed* to have access to
>>>> the lowest level representation and build stuff on top of that
>>>> 
>>> But in this "systems language", it's a O(n) operation to get the nth
>>> character from a string, to slice a string based on character
>>> offsets, or to determine the number of characters in the string.
>>> 
>>> I'd gladly pay the price of a single interface vtable lookup to turn
>>> all of those into O(1) operations.
>>> 
>>> --benji
>>> 
>> Then borrow, buy, steal or build a class that does that /on top of
>> the D arrays/
>> 
>> No one has said that this should not be available, just that it
>> should not /replace/ what is available
>> 
> The point is that the new string class would be incompatible with the
> *hundreds* of existing functions that process character arrays.
> 

That is an issue with (and *only* with) "the *hundreds* of existing functions 
that process character arrays".





More information about the Digitalmars-d mailing list