[erlang-questions] Re: Supervisors as factories *and* registries

Jay Nelson <>
Tue Mar 23 01:33:57 CET 2010


On Mar 22, 2010, at 4:40 PM, Garrett Smith wrote:

> Up to this point, I've been leery of using ETS tables (feels like
> cheating, like using the process registry)

It's not quite the same, but you have to worry about side effects and  
testability for solid software.  You can do the same thing using  
gb_trees and a separate process.  The key is that the separate  
process (or the ets table) have an externally visible way to access  
it.  Since there's no state location or way to store it, you end up  
using a global name.

I tend to avoid global names if possible because I want the option of  
concurrency everywhere and global names make that hard.  But  
sometimes you don't need it (there is a single supervisor in this  
case after all), and you need to solve the problem at hand.  The ets  
approach is clear, concise and conceptually easy to understand and  
can be verified independently of the supervisor itself in a test  
environment.

jay




More information about the erlang-questions mailing list