[erlang-questions] *current* value?

Ola Andersson A ola.a.andersson@REDACTED
Wed Oct 17 14:58:03 CEST 2007


Normally you never use the process dictionary. You could use a named ets
table instead but there are very very few
situations where you actually need either of those.
Most of the time there is some sort of main loop where the code is
executed. The input data to the loop function
is the place to use as storage for any data you need to keep. 
/OLA.

 

________________________________

	From: erlang-questions-bounces@REDACTED
[mailto:erlang-questions-bounces@REDACTED] On Behalf Of YC
	Sent: den 17 oktober 2007 07:03
	To: Erlang Questions
	Subject: [erlang-questions] *current* value?
	
	
	Hi all - 
	
	Is process dictionary the only built-in language level facility
to return context-dependent data, in Erlang?  e.g., self() returns the
"current" process.
	
	%% hopefully only assign once...
	set_current_request(Req) ->
	  set(current_request, Req).
	
	%% retrieve the request. 
	current_request() ->
	  get(current_request).
	
	Please let me know if there are better ways of accomplishing the
goal.
	Thanks,
	yc
	
	
	
	

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20071017/3e717ca6/attachment.htm>


More information about the erlang-questions mailing list