to const or not to const

terranium spam at here.lot
Sat May 10 13:01:54 PDT 2008


this example was born in thinking, how C# lives without const, this is closely connected with the nature of arrays. Strings in C# are immutable by the String class desing, but you can't take slices, if you want substring, you make it. Arays there are always mutable, and how do you really need an array slice? D strings are char arrays modified with language-level attribute, in .Net String is a mutable object with immutable content, and immutability is achieved through class-level implementation. Do we really need const for immutable strings and do we really need strings to be arrays?



More information about the Digitalmars-d mailing list