Hi<br><br>Any chance that something like the following will be implemented in the Erlang langugage?<br><br>function(MatchSpec) -><br> receive<br> MatchSpec(Result) -><br> Result<br> end.<br><br>Result could be a [{var(), value()}] list, where var() somehow is specified in the given MatchSpec. MatchSpec could as well be "used like a fun";<br>
<br>function(MatchSpec) -><br> receive<br> MatchSpec(A, B, C) -><br> [{a, A}, {b, B}, {c, C}]<br> end.<br><br>I happens every now and then that I write code that is data driven, in a way where I have a specification and an engine executing this specification. Not seldom this ends up in me wanting to receive specific messages from the process queue.<br>
<br>Another use for a "boundable" match spec is in function heads:<br><br>function(MatchSpec(Result) = Value, [MatchSpec | T]) -><br> %% something<br><br>This too I find lacking in the Erlang language.<br><br>
It is usually possible to find a workaround for this that is less flexible and results in a lot more code.<br><br>/Fredrik<br>