[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Luerl
- From: Axel Kittenberger <axkibe@...>
- Date: Tue, 21 Feb 2012 16:47:40 +0100
Immutable, but with lazy evaluation would be my ideal (that is some
values are calculated only when needed, but stored as cache. But since
the table is immutable, and the function obviously should not depend
on side-effects, the result is constant as well).
Anyway, I'm just restructering a larger project into immutables,
because I had a long debug session, because I did something in a loop,
that did something, which effected something, which changed the array
the loop was running over. Of course it's easy to make a copy of it,
before looping over it, but that highlights only the other problem I
had, I had to make copies of everything all the time, because the
caller might change it later on, or the callee might change it, or
something else might change it. In total I'm convinced my case it will
be even faster with "immuting" everything, similar to moving from C to
Lua made things in fact faster, since it gets just easier to write
good code, with Lua tables everything magically became a hashtable
what were array for me before.
On Tue, Feb 21, 2012 at 4:20 PM, Mark Hamburg <mark@grubmah.com> wrote:
> Doing a lot of work with systems that work with values that are expected to be treated as immutable while working with "internal" mutable structures — e.g., caches — what I long for in Lua is a cheap way to have immutable data. Proxy tables feel fairly heavyweight and of course until you get to 5.2's __pairs metamethod not particularly transparent.
>
> Mark
>
>