Process declarations:<br><br>Thinking out loud....<br><br>Proposal 1 (Radical)<br>==========<br><br>Do away with spawn. Replace with a process keyword:<br><br><br>Today<br>=====<br><br>-module(foo).<br>-export([bar/1]).<br>
<br>bar(X) -><br>    receive<br>        X -> ...<br>    end.<br><br>-module(bar).<br>...<br><br>g(X, Y) -><br>    Pid = spawn(foo, bar, [X]),<br>    ...<br><br>Tomorrow??<br>==========<br><br>-module(foo).<br>-export([bar/1]).
<br><br>process bar(X) -><br>    receive<br>       X -> ...<br>    end.<br><br>-module(bar).<br>...<br><br>g(X, Y) -><br>    Pid = foo:bar(X),<br>    ...<br><br>Why?<br><br>So that we can name processes. Things without names we cannot talk about.
<br>So if we write:<br><br>    f(X, Y) -> ...<br>    process g(X, Y) -> ...<br><br>    Then evaluating <br>    <br>    A = f(X, Y) works as usual<br>    <br>    But <br><br>    Z = g(X, Y)<br>    <br>    *always* results in Z being a Pid
<br><br>Proposal 2 (Conservative)<br>=========================<br><br>-module(glurk).<br><br>-export([foo/1]).<br><br>-process([bar/2]).<br><br>foo(X) -><br>    1.<br><br>bar(X, Y) -><br>    spawn(fun() -> 1 end).
<br><br>Extend the parser to understand -process attributes (as above)<br><br>Note this implies that the function is exported from the module,<br>which would put an end to the horribly practise of artificially<br>exporting functions that are known to be targets of spawns.
<br><br> /Joe<br><br><br>