[erlang-questions] refactoring a very large record
Thu Oct 20 18:14:20 CEST 2011
# Jesper Louis Andersen 2011-10-20:
> Further complication is that this piece of code may
> origin from another module so to see if we are allowed to do it
> requires whole-program analysis.
And even if the analysis was feasible, updating values in-place means
you're introducing forward pointers on the heap (or pointers from old
generation to nursery even), which may complicate garbage collector.
> There are type systems built for the purpose of tracking such
> properties. See for instance Uniqueness types in the language Clean.
> Thus the types can guarantee an access pattern that means the above
> construction would be a type error. And thus you could destructively
> update Z.
BTW A bit off-topic -- some recent work on the subject is:
Looks like a pleasant language to use, and I like the sorts of usage
contracts he can express with affine types, but the papers are a bit
too theoretical for me to fully appreciate... I'm saying this just
because I've been daydreaming about a functional programming language
that would be (practically) usable in systems/kernel programming for
quite a while now, this seems like a step in that direction. Maybe.
More information about the erlang-questions