Semantic Monitors: a proposal

Guilherme Andrade g@REDACTED
Tue Feb 16 18:32:04 CET 2021

Hello list,

I've spent years writing boilerplate for associating process monitors with
other identifiers and react appropriately (and performantly) when one of
those processes terminates.

But: what if we could attach data to a monitor and get it back in its DOWN

You'd optionally associate data to a monitor when creating it:
    * Ref = monitor(process, Pid, [{data, {user_id, <<"12345">>}}])

And you'd get it back upon the monitor being triggered:
    * {'DOWN', Ref, process, Pid, Reason, {user_id, <<"12345">>}}

Regular monitors would still work the same way and keep the current DOWN
message format - nothing would break.

I've explored this concept using NIFs and published the result to GitHub:

Is this a good idea? If so, would it be feasible to implement it in OTP?
Should there be an EEP first? I'd be willing to contribute to either.

Any input is welcome.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the erlang-questions mailing list