Am Sun, 19 Oct 2014 22:33:32 +0400 schrieb Dmitry Olshansky <dmitry.o...@gmail.com>:
> 17-Oct-2014 16:42, Marco Leise пишет: > > Am Fri, 17 Oct 2014 00:42:24 +0000 > > schrieb "IgorStepanov" <wa...@mail.ru>: > > > > OK, I've run into the same problem and there is no line > > number, just: > > > > Error: immutable method Lib.Sys.File.File.~this is not callable using a > > mutable object > > Error: mutable method Lib.Sys.File.File.~this is not callable using a > > immutable object > > > > haha! I should start from scratch. > > > > Been there. Which implies that we can't have ref-counted const object > (or ref-count has to leave outside of immutable section). Moving the reference count out, means that as soon as you add another immutable layer around the object, it is in the way again. And at that point you turn to "looking it up" instead of pointing directly to the ref count. And then you wonder why it is impossible to use a pointer into an external table, but using a size_t as an array index to an external table is ok. And then you get flash backs of why it is likewise not possible to store mutable elements in an otherwise immutable container. Wait a second... what is immutable trying to achieve again? * Avoiding string copies, because we know no one can modify them. -> Ok, they have no reference count. * Allowing for pure functions where all parameters are immutable. -> Reference counting would be an impure action. * Act as shared at the same time. -> This is what I would like to make use of to avoid code duplication with shared/unshared methods. -- Marco