KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I want to provide multiple implementations of a message reader/writer. What is the best approach? Here is some pseudo-code of what I'm currently thinking: just have a set of functions that all implementations must provide and leave it up to the caller to hold onto the right streams (ns x-format) (read-message [stream] ...) (write-message [stream message] ...) return a map with two closed functions holding onto the stream (ns x-format) (defn make-formatter [socket] {:read (fn [] (.read (.getInputStream socket)))) :write (fn [message] (.write (.getOutputStream socket) message)))}) something else?
Tags (comma-separated)
Save Edits
Cancel