portland-or

Clojure in PDX yo!
2016-10-13T03:02:38.000004Z

November’s meetup is a remote presentation on spec by Stuart Halloway https://www.meetup.com/clojure-pdx/events/234818929/

bill 2016-10-13T14:59:05.000006Z

awesome @juliobarros

bill 2016-10-13T15:00:05.000007Z

Reading Alex Miller’s wonderful post on Clojure collections this AM: http://insideclojure.org/2016/03/16/collections/ He says: "Ideally traits would be defined as Clojure protocols, but their implementation dates back to the earliest days of Clojure, well before protocols existed and as such they are defined by Java interfaces.” A little poking led me to the happy discovery that ClojureScript, by dint of being developed post-Clojure-1.2 I suppose, and having the benefit of Protocols, implements the collection traits as protocols yay!

🤓 1
bill 2016-10-13T15:09:44.000009Z

related question: I notice from the Sequences documentation, this extremely clarifying blurb: "Many of the functions in the seq library take one or more collections, call seq on them, and then operate on the resulting seq. In other words, many of these functions take collections but operate on their seqs.” I wonder why the implementors chose to (unconditionally) call seq on a (collection) argument instead of adding a function (of ^ISeq) to the multimethod (in each case) and using dispatch instead. Wouldn’t dispatch have a potential performance advantage?

bill 2016-10-13T15:25:32.000012Z

Apparently (and happily) the whole notion of “interfaces” (as opposed to “protocols”) is entirely absent from ClojureScript. A clue is here: https://github.com/clojure/clojurescript/wiki/Differences-from-Clojure#compilation-and-class-generation “`gen-class`, gen-interface, etc. are unnecessary and unimplemented in ClojureScript"

bill 2016-10-13T15:28:26.000014Z

And so, circling back to my original question about the seq call versus multimethod dispatch on ^ISeq (an interface type)—that wouldn’t work in ClojureScript I suppose.

bill 2016-10-13T15:29:35.000015Z

(see “Hinting” in ClojureScript: https://github.com/clojure/clojurescript/wiki/Differences-from-Clojure#hinting)

bill 2016-10-13T15:31:58.000018Z

But wait, David Nolen fixed “Support Types & Protocols as Type Hints” in ClojureScript: http://dev.clojure.org/jira/browse/CLJS-308 So apparently, multimethod dispatch on ^ISeq (the protocol) would work in ClojureScript.