On 6/18/15 6:26 PM, ZombineDev wrote:
On Friday, 19 June 2015 at 01:07:10 UTC, ZombineDev wrote:
On Thursday, 18 June 2015 at 23:32:03 UTC, Andrei Alexandrescu wrote:
[..]
I also noticed that the `front` primitive returns only `const ref`
(instead of `inout ref`). Is this because the user should regard the
SList as immutable - i.e. if you want to change an element, you have to
make the modification in a copy of the list, instead of doing it inplace?
Yah, traditionally functional data structures don't allow their clients
to mutate the data AND the topology of the container. So front() returns
a non-mutable ref.
It might be interesting to explore containers that allow mutation of
data but not of topology. We may collectively think of a few
applications of that. For now I went the traditional route.
Andrei