const?? When and why? This is ugly!

Derek Parnell derek at psych.ward
Sat Mar 7 06:19:41 PST 2009


On Sat, 07 Mar 2009 07:11:45 -0500, Burton Radons wrote:

> Perl would be more powerful if its strings
> were mutable, not less, although not by much
> due to the interpreter.

I think we have a terminology issue.

We have character arrays (some fixed length, others variable length -
doesn't matter). In D's world view, data can be invariant (nothing gets to
change it), const (other routines can modify it but this routine will not),
or mutable (anything can change it). So in D we have some character arrays
that are invariant (eg. Literals), some are const, and some are mutable. It
is a pity that D's term "string" is being used in discussions as if it is
synonymous with character array - but it is not. It only refers to certain
types of character arrays - the invariant ones. We really need some simple
terms for const and mutable character arrays.

-- 
Derek Parnell
Melbourne, Australia
skype: derek.j.parnell



More information about the Digitalmars-d mailing list