[erlang-questions] Reassigning variables
Wed Mar 18 23:44:09 CET 2009
On Wed, Mar 18, 2009 at 11:37 AM, Ulf Wiger
> Whether it's more readable is perhaps a matter of
> taste. It ought to be easier to maintain though.
That only eliminates three of the St updates. The snippet of code I
posted has nine St updates. Not all of them output data in the same
format (i.e., a tuple with the result and a new state) and some of
them take previous outputs as their own arguments, but even ignoring
that, if you were to put all nine updates in your format, that
requires maintaining a list of 9 variable outputs and making sure that
they're in the same order as the 9 state-mutating function calls.
I don't think that's easier to maintain than being able to selectively
rebind a single St variable.
More information about the erlang-questions