Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upAdd a new function: Signal.sendMessage : Message -> Task () () #356
Conversation
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
rgrempel
Aug 22, 2015
Contributor
I believe that accepting this pull request would allow the following proposal to be experimentally implemented as a third-party library.
This might be nice, in that this change is a smaller change to core than that change would be.
|
I believe that accepting this pull request would allow the following proposal to be experimentally implemented as a third-party library. This might be nice, in that this change is a smaller change to core than that change would be. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
Adding to #322, seems plausible to me. |
evancz
closed this
Aug 23, 2015
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
mgold
Aug 25, 2015
Contributor
Alternatively, if the larger mailbox revamp was accepted, this would be part of it.
|
Alternatively, if the larger mailbox revamp was accepted, this would be part of it. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
rgrempel
Aug 25, 2015
Contributor
I should say that I do support the larger mailbox revamp, which would (as @mgold says) make this redundant.
|
I should say that I do support the larger mailbox revamp, which would (as @mgold says) make this redundant. |
rgrempel commentedAug 18, 2015
It would sometimes be convenient for third-party libraries to create functions that take a
Messagefor a parameter, rather than anAddressand an action. For instance, contrast these two signatures:At the moment, the second signature is legal, but doesn't accomplish anything, because there is nothing which a third-party library can do with a
Message. (SinceMessageis an opaque type and there are no functions which takeMessageas a parameter).I'm assuming that
Messageis an opaque type in part so that it is possible to provide aMessagewithout exposing theAddress(or, for that matter, the action) to the function. However, it is exactly that which would sometimes also be useful when it comes to third-party libraries.So, what I am proposing with this pull request is to include a
sendMessagefunction that would take theMessageas a parameter and return aTaskwhich, when executed, will send theMessage. I would offer these further thoughts for your consideration:sendMessagefunction would still leaveMessagean opaque type -- one still would not be able to extract theAddressor the action.Messagedoes not need to be parameterized, which has some advantages if the third-party library needs to put the messages in aList. That is, you could put several messages in aList Messageeven if the action types were different, which would not be possible for aList (Address a, a).sendMessagefunction would simply return aTask, which would still need to be sent to a port to be executed. This is why the function does not rely onNative.Signal.sendMessage, which does some magic to actually perform theTask. (We can't rely on that here, because thenSignal.sendMessagewould not be a pure function).In the end, it just seems odd that the
Messagetype can't be used by third-party libraries -- I would submit that aSignal.sendMessagewould cure that oddity without creating any problems.