two style questions

Charles Blair <>
Sun Jul 17 20:23:03 CEST 2005


> If the state can outlive the process holding it (which is possible
> for example if the state is stored in ets (and another process
> owns the ets table, as explained above), then it can make sense
> to use the registered name of a process. Otherwise, using the
> pid seems quite sensible, except for the issue of having to
> serialize the pid and present it in the external protocol.
> Using a symbolic name migh look a bit better there.

initially i had thought to use pid_to_list, but was discouraged from
using it because of the warning in the documentation: "This BIF is
intended for debugging and for use in the Erlang operating system. It
should not be used in application programs."

> You might even want to use another kind of registry than the
> built-in one, since you'd otherwise have to call list_to_atom/1
> based on information in the http message. This is a potential
> memory leak, as atoms are never garbage collected. 

thanks for the reminder: i'd forgotten that, or rather, remembered it
elsewhere but not here. it seems best, then, to create a table that
stores symbolic name / PID associations, returning the former to the
client.

thanks for your response.




More information about the erlang-questions mailing list