On Fri, 19 Mar 2010 08:43:25 -0400, bearophile <[email protected]>
wrote:
Steven Schveighoffer:
You are allowed to modify the args, they are guaranteed not to be in
ROM.
The true signature, if there existed such a thing, should be
unique(char[])[] args. Because D arrays are safe, you are in no danger
of
corrupting memory, unlike C.
In D2 all strings are immutable(somechartype)[], so how can you justify
the args[x] to be an exception to that rule?
All string *literals* are immutable. The reason is so the runtime does
not have to use the heap every time you use a string literal. You can
certainly have/use mutable strings. program arguments are runtime
decided, and are passed in one place, so they do not have to be
immutable. Making them immutable, while possible and preferred by some,
is not a requirement, and shouldn't be forced on the programmer.
-Steve