<div dir="ltr"><div>Hello list,</div><div><br></div><div>I've spent years writing boilerplate for associating process monitors with other identifiers and react appropriately (and performantly) when one of those processes terminates.<br></div><div><br></div><div>But: what if we could attach data to a monitor and get it back in its DOWN message?</div><div><br></div><div>You'd optionally associate data to a monitor when creating it:<br></div><div>    * Ref = monitor(process, Pid, [{data, {user_id, <<"12345">>}}])</div><div><br></div><div>And you'd get it back upon the monitor being triggered:<br></div><div>    * {'DOWN', Ref, process, Pid, Reason, {user_id, <<"12345">>}}</div><div><br></div><div>Regular monitors would still work the same way and keep the current DOWN message format - nothing would break.</div><div><br></div><div>I've explored this concept using NIFs and published the result to GitHub:<br>    * <a href="https://github.com/g-andrade/vaktari">https://github.com/g-andrade/vaktari</a></div><div><br></div><div>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.<br></div><div><br></div><div>Any input is welcome.</div><div><br></div><div>Cheers!<br></div><div><br>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr">Guilherme<br></div></div></div></div></div></div></div></div>