Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better SOCKET-OPTION accessors #29

Open
phoe opened this issue Mar 28, 2020 · 3 comments
Open

Better SOCKET-OPTION accessors #29

phoe opened this issue Mar 28, 2020 · 3 comments

Comments

@phoe
Copy link
Contributor

phoe commented Mar 28, 2020

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.

@orivej
Copy link
Owner

orivej commented Mar 28, 2020

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.

@phoe
Copy link
Contributor Author

phoe commented Mar 28, 2020

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™.

@orivej
Copy link
Owner

orivej commented Mar 28, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants