Extending Functionality: gen_server_ext

Shawn Pearce <>
Thu Mar 20 20:14:24 CET 2003


Erlang has a two kinds of globals:

	registered processes
	named ets tables

Without either you'd be up a creek without a paddle, or at least
being forced to hand an argument to every function to lookup a
process - what a mess.

You simply cannot write complex programs easily (meaning with few
keystrokes) without SOME form of globals.  It just happens that
Erlang's concept of globals are actually not dangerous, quite unlike
globals in most object and imperative programming languages.

Vance Shipley <> wrote:
> On Thu, Mar 20, 2003 at 10:55:37AM -0600, martin j logan wrote:
> }
> }  Code is mostly referentially transparent except when it is
> } "simpler" to cheat and have a global,
> 
> 
> I was thinking recently about how I struggled with how to write
> code without global variables when learning Erlang.  "How the hell
> can you live without globals?" I asked.  It reminded me of learning
> the C language.  "How the hell can you live without GOTOs?"(*) I
> asked having only ever programmed in BASIC.  I've never used either
> and no longer see any reason to do so.
> 
> 	-Vance
> 
> (*) C does have a goto but you're told not to use it just as you're
>     told not to use the process dictionary.  

-- 
Shawn.

  Last night the power went out.  Good thing my camera had a flash....
  The neighbors thought it was lightning in my house, so they called the cops.
  		-- Steven Wright



More information about the erlang-questions mailing list