4 ms·
I'm a bit of an erlang noob, but my projects have started to reach the complexity where keep track of the flow of information gets convoluted. However, the adv
by revoltingx 17y ago
I'm a bit of an erlang noob, but my projects have started to reach the complexity where keep track of the flow of information gets convoluted. However, the advantages that it (FP/Erlang) offers as far as providing side-effect free scalable code is too great to ignore. I understand that in his case he needs very fast access to data that 'should' be globally accessed. In which case a global variable makes sense.
So far, it has been a bit annoying not having 'global' variables in Erlang. (not even in modules)
However, good languages like Erlang offer many alternatives. Mnesia has near real-time access speeds, which you could for example implement in your render thread/process. It also has things like per-process dictionaries/hash, and ets for dirty and even faster access to 'global' data.
I suspect that a lot of it has to do with the architecture of the code. I tend to prototype fast, so I run into these issues often. But I tend to keep mental notes as to how the code would be better broken off into modules, reduce the number of passed arguments, (and makes those to the fastest possible primitives.) and move any 'global' data to mnesia.