New string implementation: dstring 1.0
Kristian
kjkilpi at gmail.com
Fri Oct 13 08:12:28 PDT 2006
On Wed, 11 Oct 2006 20:40:18 +0300, Chris Miller <chris at dprogramming.com>
wrote:
> Check out the FAQ at http://www.dprogramming.com/dstring.php and give it
> a spin.
> Documentation is online at
> http://www.dprogramming.com/docs/dstring/dstring.html
>
> Let me know what you think!
Good work indeed. Now slicing can be done... Thanks. :)
I am wondering if D itself should support something like this. Well, even
if 'char[]' will be aliased to 'string', it would make code clearer for
everybody (IMHO). It would tell that this is a string, not an array of
characters. (It alone would make the aliasing meaningful, not to mention
that you cannot slice char[] safely.)
I think one should be aware of dstring's worst case memory consumption.
For example, a huge file is read to a dstring. There is only one character
that would make the whole string to use dchars instead of char. The string
would then take four times more space than char[] would. Of course, if one
would use char[], he/she couldn't slice it (in O(1) time). :) (And it
would be probably necessary to write special routines for special cases
anyway.)
More information about the Digitalmars-d-announce
mailing list