You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Message type seems very unnecessary and like it exposes a lot of dangerous and confusing low-level details about how ZMQ works internally. Why doesn't ZMQ.send just take a array of bytes as its second argument? Why doesn't ZMQ.recv just return an array of bytes? ZMQ is message-oriented and each message is just an array of bytes. If someone wants to write to a buffer and then send that, they can do exactly that – construct an IOBuffer object themselves and then send the bytes it contains. To be helpful, ZMQ.send could easily allow passing an IOBuffer value as its second argument. You could even expose this interface:
ZMQ.send(s) do io
# write stuff to ioend
ZMQ.recv(s) do io
# read stuff from ioend
Is there any real reason to ever expose the Message type to the programmer?
The text was updated successfully, but these errors were encountered:
Note that recvdoes "just return an array of bytes," since Message <: AbstractVector{Uint8}. And you really want to return the zmq_msg wrapper directly, rather than copying to Vector{Uint8} or similar, so that you can read the data in-place for a large message.
However, send could certainly support higher-level interfaces.
(That's also why the Message type is potentially useful for sending too: you might want to be accessing the data in a read-only fashion while you are sending it, without making a copy.)
The
Message
type seems very unnecessary and like it exposes a lot of dangerous and confusing low-level details about how ZMQ works internally. Why doesn'tZMQ.send
just take a array of bytes as its second argument? Why doesn'tZMQ.recv
just return an array of bytes? ZMQ is message-oriented and each message is just an array of bytes. If someone wants to write to a buffer and then send that, they can do exactly that – construct anIOBuffer
object themselves and then send the bytes it contains. To be helpful,ZMQ.send
could easily allow passing anIOBuffer
value as its second argument. You could even expose this interface:Is there any real reason to ever expose the
Message
type to the programmer?The text was updated successfully, but these errors were encountered: