This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-08-02
Channels
- # announcements (3)
- # aws (2)
- # babashka (60)
- # beginners (21)
- # cljs-dev (35)
- # cljsrn (3)
- # clojure (53)
- # clojure-android (2)
- # clojure-australia (3)
- # clojure-europe (45)
- # clojure-france (4)
- # clojure-nl (4)
- # clojure-uk (6)
- # clojurescript (33)
- # core-typed (1)
- # cursive (13)
- # datomic (6)
- # duct (1)
- # emacs (2)
- # fulcro (10)
- # introduce-yourself (3)
- # jobs (2)
- # jobs-discuss (13)
- # leiningen (1)
- # malli (19)
- # missionary (63)
- # music (1)
- # off-topic (21)
- # pathom (3)
- # polylith (18)
- # practicalli (12)
- # proletarian (1)
- # reagent (40)
- # reitit (23)
- # releases (1)
- # remote-jobs (1)
- # ring (14)
- # ring-swagger (1)
- # shadow-cljs (13)
- # sql (30)
- # testing (27)
- # tools-deps (31)
- # vim (10)
- # xtdb (4)
x-post from #testing https://clojurians.slack.com/archives/C08LK2DH7/p1627875490001800
It probably won’t be http2 but that would be pretty cool if I could pull it off. If I can do a tcp connection easily, then that might be cool. Maybe I’ll fudge the purity of my red-green-refactor process and just setting for seeing if I get a response after doing a GET request.
@doglooksgood For these kind of questions it always helps to explain what library-in-other-language
is. Otherwise you’re limiting yourself to just the small subset of people who have extensive experience in both Elixir and Clojure.
@simongray ah, yes, my mistake. What I'm looking for is somewhere I can find the latest, carefully collected Clojure News, Topics and Job information.
The REPL (https://www.therepl.net) and lately Clojure Morsels (https://dev.to/corasaurus_hex/announcing-clojure-morsels-56ma) newsletters seem to fit the description apart from the job listings part and are well worth subscribing to
There's also https://clojure.org/news/news which is the core team collecting some news items together.
is there a robust solution for repl-driven development with records?
this was a major motivation for tools.namspace/refresh which in turn was a big motivation for stuartsierra/component
the idea being that if you can't trust your record instances, you want to have a way to tear down and rebuild every namespace using them
alternatively you can avoid using records
good points
if one works only with protocols (not interfaces) and eludes inline implementations with defrecord
/`deftypte`, would it be a better repl experience?
From Clojure Programming, when it talks about limitations of redefining constructs (just read recently) > Class instances retain inline implementations forever. Inline interface and protocol implementations in classes defined by deftype and defrecord cannot be updated dynamically for existing instances of those classes. Workarounds here include delegating implementations to separate functions that you can readily redefine as necessary (…) and instead of providing functions named by vars when implementing protocols via extend, provide the vars themselves using the #' notation. Once you update the functions held by the latter, the new functions will be used to support the protocol implementations. Not sure it is feasible or does solve anything
> is there a robust solution for repl-driven development with records? When it comes for those records to implement protocols, extension-via-metadata helps a lot for repl friendliness So that you don't find the records implementing outdated protocols
@U45T93RA6 have an example of how that works?
https://clojure.org/reference/protocols#_extend_via_metadata
I said something partly wrong: defrecords can't implement something via metadata.
What I do is replacing defrecord
with a defn that will return a vanilla map accompanied by metadata. Just like in the link above
Of course if you really want defrecord, this isn't a proper solution. It's more oriented for people using the Component library or similar designs
this stack overflow answer (https://stackoverflow.com/a/62686394/3023252) describes the issue, but in short: every time defrecord
is evaluated, the record is recompiled and all existing instances of that record are now outdated and can’t use the defined protocol functions or match the new record type
What is current tendency for new clojars net.clojars.user
? do you use your domains instead or com.github.user
? Just want to fallow what community prefer to see. I know technically it is almost the same.
I think io.github.user
is preferred since you can relatively easily create a site on that domain using github pages, so for library io.github.foo/bar
there might be a page
with docs and stuff
by create you mean guess in web browser? Technically you can create github pages whatever domain you use in clojars.
com.github.user
is reserved for official GitHub libraries, io.github.user
is the one to use for users :thumbsup:
detail, I point to what clojurains like to use 🙂
net.clojars.user
io.github.user
own domain
I'm not sure, maybe it's strange. But I didn't even try CLR clojure yet. Is there a way to do it on linux? Or is it only deployment thing?
I'm running into a reflection warning problem that seems quite strange to me. I'm creating a PNG renderer, and proxying it so that I can add some rendering hints to the createRenderer
call.
(proxy [PNGTranscoder] []
(createRenderer []
(let [add-hint (fn [^RenderingHints hints k v] (.add hints (RenderingHints. k v)))
^PNGTranscoder this this
^ImageRenderer renderer (proxy-super createRenderer) ;; line 105 in source
and getting the error > Reflection warning, metabase/pulse/render/poc.clj:105:37 - reference to field createRenderer on org.apache.batik.transcoder.image.PNGTranscoder can't be resolved.
but i'm surprised to see that it is complaining about a reference to a field rather than a method.
So that warning is correct, i think, that there is no field createRenderer
, but there is a method.
Check out this comment on clojuredocs: https://clojuredocs.org/clojure.core/proxy-super#example-5f746700e4b0b1e3652d73c5
note the error has a type : cannot reference field createRenderer on org.apache.batik.transcoder.image.PNGTranscoder
that's a bummer that proxy doesn't consider protected methods. I'm not sure how to proceed yet
it isn't so much that proxy doesn't consider protected methods, it is that proxy super works by mutating the proxy object and then does normal clojure method call, and those cannot be against a protected method
interestingly, this code "works" and renders images. i'm surprised it doesn't throw a runtime error then
it is because proxy makes the method public, but on the class you are type hinting this as it is protected
so the reflective call ends up being against the runtime type, which is the proxy generate class where the method is public, but the compile time attempt to generate a non-reflective call is against the base class where the method is protected
Ok. And if its not too much bother, is this something I need to be smarter about, or is this a bug in Clojure? or neither?
I haven't used it but you might look at something like https://github.com/redplanetlabs/proxy-plus/
there is an existing jira ticket for the fact that most calls to proxy-super end up being reflective, and their solution is to automatically add the type hint like you have, so that wouldn't fix things for you
i made an http://ask.clojure.org question with this but i didn't want to put any of this discussion in after stu's good ticket article
https://ask.clojure.org/index.php/10890/reflection-warning-about-field-when-calling-method
Is anyone pub/sub-ing happily away with one of the several CLJ clients for MQTT? Not sure which to try first. Thx! 🙏