title: Spawning functions without exporting them
body: <p>I am new to erlang and have a bit of a headache with the following scenario:</p>
  
  <p>Take this code:</p>
  
  <pre><code>-module (so).
  -export ( [foo/0] ).
  
  bar () -&gt;
      receive 
          die -&gt; ok;
          Msg -&gt; io:format ("I say ~p.~n", [Msg] )
      end.
  
  
  bar (Name) -&gt;
      receive 
          die -&gt; ok;
          Msg -&gt; io:format ("~s says ~p.~n", [Name, Msg] )
      end.
  
  foo () -&gt;
      Bar = spawn (fun bar/0),
      Bar ! "Hello",
      Bar ! die,
      Baz = spawn (?MODULE, bar, ["Alice"] ), % bar/1 not exported
      Baz ! "Hello",
      Baz ! die.
  </code></pre>
  
  <p>The process spawned with <code>spawn/1</code> works fine, but the second process spawned with <code>spawn/3</code> fails as expected because I haven't exported <code>bar/1</code> and hence I get <code>{undef,[{so,bar,["Alice"]}]}</code>. Both spawn functions that take a parameter list (<code>spawn/3</code> and <code>spawn/4</code>) also take a module name. But I don't want to export <code>bar/1</code>, because it is only used internally and never needs to be invoked from outside the module.</p>
  
  <p><strong>How can I spawn a function with arguments without exporting it?</strong></p>