[erlang-questions] A couple of design questions

Steve Davis steven.charles.davis@REDACTED
Thu Mar 26 15:15:40 CET 2009

Hi all,

I am working on a gs-style interface to wx, and was hoping someone may
have an opinion on a couple of design issues:

1) I've been maintaining an ets table to cope with naming/references
and command events. In order to keep the references unique across
multiple UI instances (processes), I've used a key format that is
basically {self(), name}/{reference, data}. I've had problems
convincing myself that these tables are safe as they must be marked
"public". However, I'm now thinking that these references would be
better off in the process dictionary (something I am usually cautious
of doing) as these stored references are, or should be (a) private to
the process, (b) "transient" with the process, and (c) irrelevant
outside the process. So my question here is: in this case, is it as
valid as it seems to me now to the use of the process dictionary to
store a fair amount of data, and if so what limitations should I watch
out for?

2) Starting the UI instance process merely uses spawn (and returns the
pid to the calling process). It's troubled me that perhaps the GUI
process should be more "OTP". However, given that this is a framework
that builds on wxe (with the graphics server already there), my
thinking is that the ownership (and supervision) of the UI process
would be better implemented by the calling application, since it can
link and supervise the UI. Making the UI run off a gen_server seems an
unnecessary complexity in the design of the framework. My question
here is: Simple though this is, is my thinking correct?



More information about the erlang-questions mailing list