On 05.06.2012 2:28, Roman D. Boiko wrote:
On Monday, 4 June 2012 at 22:21:42 UTC, Dmitry Olshansky wrote:
And you can fake immutability, buy always picking up an unused slot
btw. No need to go beyond logical immutability.
That's applicable in some cases, not in general. But I agree that often
it is possible to optimize if use cases are known.

My example concern was about fundamental problem of range APIs for
immutable data structures, which is not possible to emulate: popFront is
mutating by design.

Keep in mind Ranges are temporary object most of the time. They are grease for wheels of algorithms. Given data structure S, it's range is R(element of S). Thus for immutable data structure range will be mutable entity of immutable element type.

Interesting example is immutable strings, that still have ranges over them, that even return dchar not an immutable(char).

--
Dmitry Olshansky

Reply via email to