two style questions

Charles Blair <>
Sun Jul 17 03:19:43 CEST 2005

as a relative newcomer to erlang, i read the thread Meyer, OO and
concurrency with some interest, and wanted to isolate two comments for
further discussion here, as i have some questions about them: i want
to be sure i'm on the right track for the work i'm doing.

uffe writes:

     One could imagine a specification stating that a process waiting
     indefinitely should be automatically removed, but I have never
     considered it a problem that Erlang doesn't do so.

     In Erlang, a process waiting indefinitely for something that will
     never occur is probably (but not certainly) in a faulty state.

here's my first question: the only way i know of to keep an ets table
open in memory is to spawn a process that opens it, does whatever else
it has to, then recurs on itself waiting for a message that never
comes: is there another way to keep an ets table open indefinitely? on
a related note, does it make sense to call erlang:hibernate right
before the recursive step?

vance writes:

     ... I would add a warning about registered processes. I rarely
     use them anymore as I am a purist and in the pursuit of
     functional programming I avoid needing them. There are many
     reasons to do so, much more than using the process dictionary,
     but again doing so is often due to laziness.

here's my second question. i've implemented the server part of a
client/server protocol where data are delivered in chunks of a certain
size. in addition to the data, the server sends the client a
resumption token which, when sent back to the server by the client,
lets the server send along the next chunk of data. there are several
ways of implementing this, but the way i've chosen to do it is to use
a registered process to keep state, passing along the name of the
process in the resumption token. when i get the token back from the
client, i look up the relevant process, and pick up where i left
off. the question is, is this a reasonable implementation from the
erlang perspective? (i might add that the clients can be written in
any language; token passing is done via http. i might also add that i
switched to erlang from common lisp to force myself to write in a
purely functional style.)

More information about the erlang-questions mailing list