orivej / pzmq

ZeroMQ 4.0+ Common Lisp bindings.

Home Page:http://orivej.github.io/pzmq/doc/index.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Better SOCKET-OPTION accessors

phoe opened this issue · comments

Is there any need to create accessors for more Lisp-style access to ZMQ socket options? I realized that my own code has the following snippet for setting multiple socket options at once:

(defun set-socket-options (socket &rest args)
  (loop for (key value) on args by #'cddr
        do (z:setsockopt socket key value)))

Another idea would be to create #'socket-option and #'(setf socket-option) for Lisp-style reader and writer.

Note that with-socket (and with-sockets) allow setting many options at once, don't they cover your use case? I don't mind adding set-socket-options to the lisp-api, feel free to create such PR. socket-option on the other hand seems more confusing than useful since it duplicates getsockopt.

with-socket creates sockets with dynamic extent, whereas I want to be able to create a socket with indefinite extent.

I agree with the latter. I'll create a proper PR soon™.

I think I would also be ok with (setf (getsockopt socket opt) value) (in lisp-api) if you want to use it.