getting rid of immutable (or const)
Simen Kjærås
simen.kjaras at gmail.com
Thu Sep 5 10:47:56 UTC 2019
On Thursday, 5 September 2019 at 09:07:30 UTC, berni wrote:
>> import std.algorithm: reverse;
>> writeln(q.reverse);
>
> How to get this working? (I hope I don't annoy you by asking
> that much questions, but I've got the feeling, that I've got
> only two choices: To shy away from using immutable (like I did
> in the last three years) or ask a lot of questions in the hope
> of understanding what's going on...
https://dlang.org/library/std/range/retro.html
Difference is, retro lazily iterates in reverse order, while
reverse eagerly reverses in-place.
Don't worry about asking questions - it's a good way to learn,
and we like helping. :) Immutable is not very well supported
everywhere in the library, sadly. It seems an important building
block would be something like Reassignable!T, which would hold a
struct with immutable members, and still be reassignable with
different values.
--
Simen
More information about the Digitalmars-d-learn
mailing list