[erlang-questions] Message queue reflection (was: My biggest beef with Erlang)

Robert Virding <>
Mon Dec 10 23:15:05 CET 2007


On 27/11/2007, David Hopwood <>
wrote:
>
> > In the spirit of funs it would be very nice to say:
> >
> >      F = fun(Pattern1) -> Actions1
> >                (Pattern2) -> Actions2
> >                after Time -> Actions
> >            end,
> >      ...
> >      receive(Fun)
> >
> >       This would make writing an erlang meta interpreter much easier
> > and allow all kinds of mischief
>
> The missing feature that is needed to implement this (and lots of other
> useful things) is the ability to reflect on a process' message queue.
> That is, to iterate through messages in a process' queue without
> removing them, and then to remove a given message (rather than just
> the first message that matches a statically determined pattern).


This could lead to some really weird behaviour if programmers were allowed
to manipulate the message queue directly. Funs would be nice, but then we
would actually end up with the same problems as allowing user defined
functions in guards.

Robert
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20071210/4b6dbaaf/attachment.html>


More information about the erlang-questions mailing list