The ability of a mailbox to place events that you send into it in your signal is completely based on "magic", that is, it was implemented initially (in JavaScript), and not what you could implement yourself. This is why it is built into standard libraries.
Creating a mailbox is an imperative, effective action (shhh, don't tell anyone). Therefore, if you use:
mailbox1 = Signal.mailbox Blah mailbox2 = Signal.mailbox Blah
these two mailboxes will be different. Sending a message to mailbox2.address will result in a message on mailbox2.signal , but not mailbox1.signal . This breaks link transparency, which is bad, but until it breaks everything. (This may go too far into the tangent, but since the output requires Signal and cannot have Signal (Signal something) , in practice the uncontrolled effect of creating a mailbox does not confuse things). This "leak" will be fixed at some point in the future. There was already a proposal, but big changes were made in different versions of the language.
source share