Fork me on GitHub

Good Morning!


I only use Twitter to follow tech stuff such as library releases (although I also use github watches for that too) and technology content makers, like some interesting blogs


I don't subscribe to anything else


I thought only Trump used twitter to make political announcements


I was reading (and experimenting) with Protocols last night


I love the way you can extend a protocol to an existing datatype and thus add new functionality.

Ben Hammond11:10:48

that always seemed a bit underhanded to me

Ben Hammond12:10:02

you don't know where you are

Ben Hammond12:10:31

things that you used to rely on have been changed underneath your feat

Ben Hammond12:10:59

it can upset the principle-of-least-surprise


Sure, I can see that. With great power comes great responsibility 😉


or summat like that 🙂


Right now, I don't have a use-case in my applications (I'm getting along very nicely with multimethods)

Ben Hammond12:10:24

I prefer that t'other way round > With great responsibility > comes great power I like to tell myself that when people blame me for things

Ben Hammond12:10:19

Protocols are a hacky way to play along with Java Interfaces troll


I compare them to extension functions in Kotlin


one can extend an existing datatype in Kotlin similiarly.

Ben Hammond12:10:52

all very nefarious

Ben Hammond12:10:29

but with an intriguing Type Descriptor, certainly


i.e., fun String.spiderMan() => "Don't you mean with great responsibility comes great power?"


"foo bar".spiderMan()


i'm super wary of Protocols personally... but i think the pain i associate with them is as much because they tend to be at a boundary of java interop and the real pain is java, not the protocols themselves


nevertheless i prefer multimethods


I think I recall somewhere a diagram about when to use maps, switch to protocols, records etc...


anyone remember the diagram?


that's the one!


9 years old already


Nothing wrong with protocols in my book; open for extension polymorphism is very useful. Extending a protocol to a new type shouldn’t normally break anything as it’s normally an accretiative change. Providing you follow the rules around protocol extension of course, and either own the protocol or the type. The only difficulty with them I’ve ever had with them, is the common one where you’re at a REPL, and you reload the type or the protocol definition; and you find things don’t dispatch properly anymore because you’ve got a stale value using the old type.


Not saying you shouldn’t prefer other things to them though; just that they occupy a useful point in a spectrum of options

💯 3
Ben Hammond15:10:44

who is using Clojure in Glasgow at the moment? I know are


Arnold Clark certainly did use it quite a lot, though I think they may have moved away from it now


there was some thoughtworks stuff at some point i think?

Ben Hammond15:10:26

yeah they're doing Student Loans Co IIRC

Ben Hammond16:10:29

oooh I've not heard of them


@maleghast isn't too far from glasgow iirc

Ben Hammond16:10:11

well thats an interesting one; although he is in the Trossachs, his office is firmly in London (last I heard)

Ben Hammond16:10:25

well, noone is really in london just at the moment I suppose