lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


> With immutable lists, there are a bunch of optimizations you can pick
> up with reference counting. If you know you hold the sole reference to
> a list, you can go ahead and mutate it instead of making a fresh list.
> "The implementation may cheat, but it must not get caught."

Working now a lot with immutables, I just made an observation that in
hindsight is obvious. I cannot make any circles with immutables! Any
immutable object can only have references to objects previous in the
timeline. So the whole datastructure of a programm always folds out as
a nice tree. While I have to workaround it, logical mutual referencing
by making a proxy object instead that has references to both objects,
the same effect in my opinion would also make reference counting
highly attractive again vs. the otherwise common mark&sweep.