cljfx

https://github.com/cljfx/cljfx
thheller 2019-04-06T14:49:03.110100Z

@vlaaad not sure if you answered this anywhere but how come you are building everything in cljfx on top of :extend-via-metadata?

vlaaad 2019-04-06T15:39:19.110200Z

@thheller You mean why?

thheller 2019-04-06T16:40:07.110600Z

yeah just curious since its the first codebase I see to use that pattern

thheller 2019-04-06T16:40:26.111100Z

looks a bit unfamiliar and I wonder why you chose that pattern over just reify?

thheller 2019-04-06T16:40:48.111500Z

do you see any particular benefits?

vlaaad 2019-04-06T17:49:17.111600Z

@thheller there is no benefit for :extend-via-metadata to be in released version of cljfx, but it was invaluable during development, because you can redefine your protocol and all maps with metas implementing it will continue to work. Basically it solves a problem outlined here: https://github.com/aredington/clojure-repl-sufficient-p/blob/master/src/clojure_repl_sufficient_p/defprotocol.clj

vlaaad 2019-04-06T17:51:18.111800Z

Reifies are opaque: you can't see their internals. Going with defrecords feels unnecessary when you are still searching for fitting shape of data

thheller 2019-04-06T17:52:42.112100Z

yeah i know the redefined protocol pain

vlaaad 2019-04-06T17:53:11.112200Z

Now that everything is more or less understood, I think I'll replace maps and metas with reifies: that's why protocol implementations should be treated as black boxes in cljfx

thheller 2019-04-06T17:54:09.113100Z

yeah I'm trying to figure out if I can create some fulcro like helpers for cljfx so I'm digging through the internals trying to understand everything

vlaaad 2019-04-06T17:56:00.113200Z

I tried some time ago to replace some widely used lifecycles (such as dynamic) with reifications instead of maps, but haven't seen any performance improvements. Maybe replacing everything will be noticable

thheller 2019-04-06T17:57:20.113800Z

yeah shouldn't be a big difference I think

thheller 2019-04-06T17:58:38.114500Z

FWIW to fix the redefined protocols problem I usually move my protocol into a foo.protocols namespace which only does the defprotocol

thheller 2019-04-06T17:58:52.114800Z

and since that is only that you never end up reloading that file

thheller 2019-04-06T17:59:55.115700Z

the metadata approach however is interesting to see. not quite sure how I feel about it myself but it works 🙂