Fork me on GitHub
#clojure-uk
<
2020-10-19
>
dharrigan06:10:26

Good Morning!

dharrigan07:10:35

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

dharrigan07:10:44

I don't subscribe to anything else

djm07:10:55

I thought only Trump used twitter to make political announcements

dharrigan11:10:43

I was reading (and experimenting) with Protocols last night

dharrigan11:10:08

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

dharrigan12:10:19

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

dharrigan12:10:23

or summat like that 🙂

dharrigan12:10:43

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

dharrigan12:10:06

I compare them to extension functions in Kotlin

dharrigan12:10:23

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

dharrigan12:10:25

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

dharrigan12:10:40

"foo bar".spiderMan()

alexlynham12:10:57

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

alexlynham12:10:05

nevertheless i prefer multimethods

dharrigan12:10:59

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

dharrigan12:10:08

anyone remember the diagram?

dharrigan12:10:41

that's the one!

minimal12:10:11

9 years old already

rickmoynihan12:10:13

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.

rickmoynihan12:10:07

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 http://previ.se are

rickmoynihan07:10:06

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

alexlynham15:10:41

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

mccraigmccraig16:10:27

@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