Walter Bright wrote:
If I may restate your case, it is that given function that does something with character arrays:

int foo(string s);

and you wish to pass a mutable character array to it. If foo was declared as:

int foo(const(char)[] s);

then it would just work. So why is it declared immutable(char)[] when that isn't actually necessary?

The answer is to encourage the use of immutable strings. I believe the future of programming will tend towards ever more use of immutable data, as immutable data:

1. is implicitly sharable between threads

In fact const data is also implicitly sharable between threads. This is because shared is not implicitly convertible to const. No?

Andrei

Reply via email to