You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I guess it can always be solved by passing a state around, but it might not be convenient. Here are use-cases where I think using dictionary is reasonable:
In Erlang's mnesia application, mnesia:transaction/1 is using process dictionary to pass some data to calls like mnesia:read or mnesia:write.
Similarly in ejabberd, ejabberd_sql:sql_transaction is using it to pass state data to SQL queries inside it. When porting it to Lwt and Eio I used with_* calls mentioned above to keep the same API.
Also in ejabberd some usage statistics is put into the process dictionary, because it's much cheaper to read it with erlang:process_info than to do gen_server:call to thousands of processes.
Having something like Erlang's process dictionary would be useful. Maybe with API like Eio.Fiber.with_binding or Lwt.with_value.
The text was updated successfully, but these errors were encountered: