Fork me on GitHub

yes, but no code available except Oh well...


NodeJS? Bleh...


Yeah. Js is ugly, but gets stuff done.


Well, Clojure is beautiful and gets stuff done 😛


But hey, there's a lot of hipsters out there who convince management that V8/NodeJS is "faster and more lightweight" than the JVM


they still use clojure it seems:

👍 24

for those that don't want to click link: >I wrote and deployed (to production) some Clojure code at Netflix just yesterday. Among other things at Netflix the Mantis Query Language (MQL an SQL for streaming data) which ferries around approximately 2 trillion events every day for operational analysis (SPS alerting, quality of experience metrics, debugging production, etc) is written entirely in Clojure. >This runs in nearly every critical service, ~3000 ASGs and easily > 100k servers and Clojure allows us to also compile it for our NodeJS services as well.


I think there's a lot of Clojure running out there but folks just don't write about it as a matter of course -- it all goes smoothly and without drama and folks are just too busy getting s* done.

☝️ 28

i’ve always thought this to be the case, too. i wonder how we could prove it?


I blogged a lot about Clojure when I got started. Recently, not so much. Clojure evolves slowly, it's stable, it "just works". I haven't felt the need to blog about stuff much lately.


I agree, although I think Kubernetes has some very interesting and positive implications for clojure.


I'm always reminded of those old Bently? ads, "Move along youngster, you'll know when you're ready."


so I have a coll of maps I want to dedupe by a key in each map; I was going to just copy clojure.core/distinct and introduce an arg f to dedupe by, and call it distinct-by. Am I missing something by going this route? Meaning, is there a better built-in approach?


(distinct-by :foo [{:foo :bar} {:foo :baz} {:foo :bar}]) => ({:foo :bar} {:foo :baz})


you could copy the distinct code and use sorted-set-by to create the initial value for the internal accumulator


you just use a normal set


you just need the value of the by-fn in the set


@zilti I think in many cases it less about the VM and more about the ecosystem (libs, docs, etc..)


The ecosystem is hardly something where the JLM is lacking though


spending most of your time doing interop is not fun


Is there a way in clojure to create a java class with a typed field? Adding type metadata to the field in defrecord doesn't do anything unless it's a primitive type.


I believe except for some primitive types, no. It is recommended to use Java to create a class with full control over the options.


Is there a reason for this?


it does do something


A reason that Clojure doesn't provide all the knobs for class creation that Java does? I think because it would be a lot of work to implement all of those knobs in Clojure, and the Java compiler is right there.

👍 4

And this work cannot be re-used in ClojureScript.


usage of the field in the body of an inline extend type or implementing the interface will see the effect of the type hint


I just need to specify the type of the field for interop purposes, and not have it just be Object.


what kind of interop requires a field type?


this sounds like java interop with clojure? not clojure interop with java?


Yes, java wants to inject something based on an annotation.


I am pretty sure the type hint syntax doesn't do annotations anyway


last I checked this was a special syntax used in some places that extends the basic type hint syntax, but the general type hint syntax used everywhere doesn't include it


we are both confused in different ways


it is correct that type hints don't support annotations, but that is because they aren't part of the type hint but just generally part of metadata attached to a field


This will put the RInject annotation on the redisson field, but the type is Object. Verified by examining the generated class file.


the :tag ... part is the type hint, the other part (which is used as an annotation) is "other stuff in the metadata map"


Yes, sorry, misread your earlier point.


that is kind of a shame

Alex Miller (Clojure team)20:10:46

Is it? It would break a lot of the untyped assumptions in the map interface records implement


it would, but it also makes annotations on record fields a lot less useful


(not that I have ever had to use such a thing)


deftypes don't implement the map interface, so in theory they should be fine, the tricky thing is, because defrecord is built on deftype, ensuring that the underlying machinery respects the hints for deftypes, and just uses Object for defrecord


This turns out to be an odd case, because the Java framework I'm using (Redisson) has a bug in their logic that checks if the field designated for injection can be assigned an object of type RedissonClient. Obviously that should work fine for an field of type Object, but they got the arguments switched.