Fork me on GitHub
#clojure-uk
<
2020-11-09
>
dharrigan06:11:30

Good Morning!

djm08:11:03

đź‘‹

dharrigan13:11:25

Is reify perferred over proxy nowadays?

mccraigmccraig14:11:06

they have slightly different capabilities iirc - proxy lets you extend an abstract class, reify is interface only. i tend to use reify more, but that's probably because i'm more often implementing a protocol than extending an abstract class. i've no idea if one is "better" than the other for just implementing java interfaces

Conor14:11:39

Reify has better performance than proxy

dharrigan15:11:10

Right, cool, so it's interfaces I'm extending. Rigthyho

dharrigan15:11:09

Here's another question, say you have an interface with, say 5 methods, with reify, do you have to provide implementations for both, or can you implement one and ignore the rest?

bronsa15:11:32

you can, the missing methods have a default impl that throws

bronsa15:11:45

user=> (definterface i (f []) (g []))
user.i
user=> (.f (reify i (f [_] 1)))
1
user=> (.g (reify i (f [_] 1)))
Execution error (AbstractMethodError) at user/eval157 (REPL:1).
user$eval157$reify__158.g()Ljava/lang/Object;

dharrigan16:11:44

that's good to know.

dharrigan16:11:47

thank you! 🙂

Conor15:11:17

Is 20% of a bird a bird?

Conor15:11:53

AFAIK you need to implement them all. You could probably give them no-op implementations, though

dharrigan15:11:02

That’s a profound question. Is 20% of a bird a bird? Depends on the use-case I suppose 🙂

dharrigan15:11:09

I mean, at the DNA level, I suppose yes, it’s still a bird.

dharrigan15:11:55

I had roast chicken last night. Perhaps about 20% of that chicken was consumed 🙂

cdpjenkins15:11:08

<delurk> I take the view that an interface is a contract. “Implement these methods and then your reified class satisfies the contract (and is a bird or whatever).” If you don’t implement all of them then you don’t comply

mccraigmccraig15:11:38

anyone here using clojurescript with react-native atm ? what's the best toolchain now ?

alexlynham16:11:50

@mccraigmccraig cordova finally crossed you for the last time?

mccraigmccraig16:11:48

@alex.lynham pretty much. insufficient community energy behind it, too few plugins with too low quality

alexlynham17:11:46

the question is how long before react becomes the rails of the JS world

mccraigmccraig20:11:20

would that be a good thing? i liked rails - wasn't so fond of ruby tho

alexlynham07:11:56

think i was the opposite, quite liked ruby, came to resent rails

alexlynham07:11:21

either way i just mean in terms of 'becomes the one way to do things, then becomes obsolete'

alexlynham07:11:37

but i spose that happens to everything

mccraigmccraig09:11:38

maybe i stopped using rails before obsolescence set it... ruby's awful scoping and bad-magic metaprogramming facilities really did my head in though

alexlynham11:11:31

yeah the metaprogramming got p wild and unmaintainable p fast

dharrigan21:11:08

Someone pointed me to this today: https://devdocs.io/

dharrigan21:11:13

has clojure too