On Friday, 11 January 2019 at 08:45:12 UTC, JN wrote:
On Friday, 11 January 2019 at 08:15:01 UTC, rikki cattermole
wrote:
Note the immutable, it means you cannot modify individual
values. Which is a problem for reverse because it modifies in
place.
The error message is kind of unfortunate. This is a simple
usecase and the error message is undecipherable already. It'd
be cool if the compiler could try to strip immutability, and if
the type matches then, throw an error something like "Cannot
pass immutable char[] to reverse, did you mean char[]?".
That would help a lot, as I got "rikki cattermole"'s answer at
once, when my eyes were brought to the "immutable" part.
I come from the lisp world, so I'm kind of familiar with the idea
of copying and/or modifying in place to limit consing. I guess I
should I have realised this would be a perfect example of that
kind of situation.