>
> (fn [_ _]  ;dispatch-function checks for OS - ignores args
> (let [os (System/getProperty "os.name")]
>   (if (.startsWith os "Mac OS") :Linux  (keyword os)))))
>

This seems like a very poor use of multi-methods. Multi-methods exist to 
provide both dynamic and open dispatch. In this case, the dispatch function 
is completely static.

If you don't need dynamism or openness, then you're better off with a 
simple case form at the top level:

(case platform
  :linux (def halt [root-pwd minutes-after] ...)
  :windows ...
  ...
  (def halt [& args] (throw ...)))

If you prefer the appearance of top-level forms, or need the openness, you 
could pretty easily implement a static version of defmulti & defmethod 
which ensure you only pay the dispatch cost once at startup, rather than on 
every invocation.

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to