This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-09-17
Channels
- # announcements (17)
- # aws (2)
- # babashka (21)
- # beginners (67)
- # calva (19)
- # cider (29)
- # clara (3)
- # clj-kondo (6)
- # cljsrn (10)
- # clojure (140)
- # clojure-europe (164)
- # clojure-nl (3)
- # clojure-uk (8)
- # clojurescript (62)
- # conjure (7)
- # core-async (24)
- # cursive (21)
- # datomic (5)
- # docker (40)
- # emacs (14)
- # fulcro (25)
- # gratitude (1)
- # honeysql (6)
- # introduce-yourself (1)
- # jobs (1)
- # jobs-discuss (32)
- # juxt (7)
- # lsp (13)
- # minecraft (2)
- # off-topic (49)
- # pathom (24)
- # practicalli (8)
- # re-frame (18)
- # react (23)
- # remote-jobs (6)
- # reveal (2)
- # shadow-cljs (75)
- # tools-deps (7)
Morning!
Good morning, and good coffee to you all!
What’s your favourite language apart from Clojure (and Clojurescript 😛 )?
(and why)
I don't have any favorites but I do like to explore other languages. The next one on my list is Zig, but I don't really have a good use case for that one personally
Do Rust and Go aim at the same type of applications, just in different ways?
Go is basically a dumbed down Java with go-routines which compiles directly into machine code.
I see
From what you say, and what I’ve heard before, my impression is that Go, the language, is not very interesting in itself
I mean, concept-wise. But perhaps it tries to be boring. That’s a valid goal in some contexts 🙂
Kind of the opposite of Clojure, which, in my book, is a firecracker of cool and useful concepts
yeah, the language isn't that special, but it yields small binaries (relatively speaking) and the ecosystem is pretty rich by now
I usually enjoy programming even in non-optimal languages like bash and JS but that's just my problem ;)
Non-optimal by which standard? Language design?
well, I feel the same about those langs, for a hazy, subjective definition of “non-optimal” 🙂
😂 That’s almost exactly what my response would be as well, except I haven’t dabbled with Go
I used it extensively in my previous job. Highly interoperable with Java, runs on the JVM, quite functional oriented (still quite imperative too), but brings in a lot of things that cuts down the ceremony that one has with Java
There are things now in Java 16/17 that existed prior in Kotlin - so there is healthy cross pollination going on.
Very good tooling support from IntelliJ IDEA (as one would expect, as Jetbrains are the originators of the language)
I like C - it’s very direct. Zig is to C as Clojure is to Java - a language that is fully interoperable with the C ecosystem.
I’ve always thought that it’d be perhaps boring, but very useful, to learn C.
I like high level abstractions. Handling memory directly seems like a chore to me.
You can write a lot of useful programs without doing memory allocation! Don't be put off
@raymcdermott I hope to get something in bb so you can use C libs directly from bb like in Python
Just updated the github issue for using c libs in bb with the latest progress, https://github.com/babashka/babashka/issues/978#issuecomment-922076622 Clojure's support for calling c libraries is very good. There's https://github.com/Chouser/clojure-jna/ , https://github.com/cnuernber/dtype-next/ , and a newer option called https://github.com/IGJoshua/coffi Here's what it looks like using dtype-next:
(ns ffiexample.clj
(:require [tech.v3.datatype.ffi :as dt-ffi]))
(dt-ffi/define-library-interface
{:strlen {:rettype :size-t
:argtypes [['s :pointer]]}})
(strlen (dt-ffi/string->c "Hello World"))
;; 11
It even supports repl reloading and compiling with graalvm's native-image.@smith.adriane Very interesting. The question is: would this work dynamically in bb
`dtype-next` doesn't dtype-next's support for graalvm's ffi interface doesn't allow dynamically calling c libraries but using libffi you can load shared libraries dynamically and call them
so I just wrote a dtype-next wrapper for libffi so you can ffi while you ffi
@smith.adriane Meanwhile we've been developing a library for the build time initialization issue.
https://github.com/clj-easy/graal-build-time
You can just include it in your build and leave out the other --initialize-at-build-time=
options
yea, that looks awesome! looking forward to deleting a bunch of lines from my libs. I think it's still necessary to have the intialize-at-build-time
flag since dtype-next relies on single segment namespaces
alternatively, we could just make a pull request to dtype-next to add the primitive-math classes to the initialize-at-build time list similar to how graal-build-time works
Would it just require creating a class in dtype-next like https://github.com/clj-easy/graal-build-time/blob/main/src/clj_easy/graal_build_time/InitAtBuildTimeFeature.java that adds the primitive math classes to the list?
yeah. I tried tweaking clj-easy to include single segment classes, that may also work
but not sure if that's a good idea. I think we should encourage multi-segment nss in the community anyway
sure. primitive math is archived, but we could fork it, change the namespace, and use that as a dependency
I think since that library is archived anyway, it might make sense for dtype to "mranderson" / vendor it
This is very awesome work. I will study it more in the weekend. The binary size is a bit concerning, but we can at the very least make an experimental SCI-based tool where we incorporate this and see how it evolves. Also with respect to building other Clojure libraries as shared libs. Would it be possible to pass function references over the native FFI border for example? I would be surprised if this was possible.
I converted the issue into a Github discussion to have more room for threads, etc.
> Would it be possible to pass function references over the native FFI border for example I also doubt that this is possible.
@smith.adriane has some ideas about this
@reefersleep Probably Python, mostly because of its rich ecosystem, its relatively simple idioms and because it (unlike Clojure) is all about being beginner-friendly. Python is like a modern Basic… in a world where Basic is also used to develop cutting-edge machine learning algorithms.
I don't really have any other favourite lang than Clojure/Script. I would love to do some work in Rust both because it is a challenging language (in a similar way as Clj was) and because it would allow me to the low-resource, high-perf domain where JVM is not suitable. Wolfram Language is also fascinating but as I understand it it is primarily for exploring and presenting data, not really for creating stuff.
I find the more clojure I do, the easier it is for me to understand other lisps. The only other lisp I've done professional work in is elisp, and that feels easier to read nowadays.
I think my problem with common lisp and scheme was that I just reached a point quickly where I wasn't solving my problems any more, I was writing xml or json parsers (tho it has been a few years)
I still like Java, though I am biased, as I work with it for 13 years, now. The latest additions are really nice and enable devs to use a more functional style (although the syntax for it is still not ideal). I was a little ranty about Java in the last two years, but I realized I don’t have an issue with the language, but with the common and established architecture and patterns.
One downside: The “later” releases breaking downwards compatibility is a shame.
Some things have been removed entirely like JavaFx. But continue stand alone, and there are some limits on reflection. Not sure from which version the warning become/became errors.
The modularization removed some default things, also the deprecation of the security manager and the harder reflection restrictions, which increased with the latest versions
As a result, Lombok will likely stop working in the future, because there won’t be any workaround for what they are currently doing
Not sure that's entirely a bad thing. I like how Lombok prevents a lot of boilerplate, but then you need plugins for your ide to work with it and sometimes weird errors.
I don’t use Lombok either, for these reasons, but a lot of people do and it adds to the general frustration. People generally like the new features, but the Java Architects and Devs did not yet really manage to properly communicate the benefits of the module systems for developers.
Modules are only really beneficial if others use your code. It's really nice to have a clear seperation between what's considered to be the API and what not. You can build smaller apps, but that's not often really useful.
I feel like Java could be a fantastic language if you made all of the Java devs unlearn all of the heavy-handed OOP and XML fetichism. The problem with Java are the existing codebases, not the language itself (apart from a few rough spots).
I held a talk some times about how the “we might need it one day” boilerplate architecture for Java could be broken up, and that it is not a capital crime to decouple every little aspect of your software from anything else. When it came to the slides, that you don’t need to load DB entities from the DB, map it to the service layer and then to the DTO which are mapped to JSON, but that you just can extract the “Frontend Objects” directly in some cases, there were questions like “Yeah, but that’s not allowed, is it?” 😅 Edit: https://app.pitch.com/app/presentation/10ee9dd4-bfce-4e24-a858-0398ebf282a4/3be4ca15-6494-4b61-9e7f-4dfa0ae8125d
@U0N9SJHCH Just gone through that slide deck -- good stuff! And very much an argument I've had with people in a past tech life who were slavishly wed to their four-layered architecture. Glad I'm not the only "heretic" 🙂
Thank you! Also talked about this with Oliver Drotbohm from the Spring Data team at one meetup, this is also something he tries to promote. We are many 😄
What’s the “non-traditional” way to pass around data in Java, then? use “untyped” hashmaps like in Clojure?
Since I moved from Java to Clojure in my day job, I’ve thought about Java code bases with public static methods everywhere and no particular data types, just maps and lists. But, I thought, “no one will work with me if I do it like that” 🙂
There are some articles / a book on using HashMaps in Java, but it is not well received by the Java devs, and imho non-idiomatic. It has a static type system after all, and circumventing it won’t do any good. While the “default” currently is to have one class for the database representation, one class for the domain logic and one class for the frontend object, which are decoupled via mappers, my preferred way (for read access, at least) is to have one object which represents the frontend data, and populate it directly from the database. This is only viable if the database is the “single source of truth”, if you pull data from different sources this won’t work as well. But a lot of applications out there are still that simple, so there is no need for the whole boilerplate and ceremony.
There is a blog post ripening in my brain about applying Clojure Concepts to Java, but it is more along the way of “composing libraries instead of using frameworks”, “composing your system of subsystems” and “immutability”. But it’s not quite there, yet.
@U0N9SJHCH sounds interesting!
I guess you can also get more transparency by avoiding doing side effects in your DTOs, or just have them be entirely "dumb" to begin with.
And, generally, trying to make your functions as "pure" and side-effect free as possible. I guess that, when immutability is not built in, mutation can be OK, as long as it's obvious.
Yes, I guess that’s good practice in every language, OOP or FP or both. That’s the “Frameworkless” part. Many Java Frameworks force you to build “Java Beans” with getters and setters for every field, which means mutable state everywhere. I’m not sure why this style is so widely adapted, because from my understanding, that’s not what OOP should be about either
Yes, so Records to the rescue right? But will take a while till it works 'Frameworkless'.
That’s the neat part with the latest updates 🙂 Not everything can be a record, but pattern matching will promote records very well
I don't really have another favorite, Java, Kotlin, Elm and Rust all have there uses and nice and less nice things. Seems like I need to do a bit of Python and Golang in the near future.
as @simongray says, it's BASIC for the 21st Century 🙂 Easy to get into, lots of libraries, simple constructs and runs about anywhere!
that and yaml ... significant whitespace needs to die ... and these days it's ingrained in my brain that comma's are whitespace 😉
@dharrigan have you ever tried Hy?
This reminds me of the question, I hate to open up a 🥫 🪱 but do people align their maps or bindings in a let
, etc...?
My editor does, and I think it reads nicely that way, so yeah 🙂
no, i don't really like it... but if the RHS of a binding is longish, i will sometimes put the symbol directly above the value expression, with an empty line
(let [foo 10
bar
(some
long
expr)]
...)
since Clojure doesn't care about this, I generally don't care about it a lot either
A looong time ago this Canadian worked in France and other parts of Europe. The custom of shaking hands with coworkers on the first greeting of the day was foreign to me, but I liked it. Good morning!
Every day?
in England there is at least a 2-5 meter distance between everyone, and that was before the pandemic
Not a Denmark thing, for sure.
where I live in Scotland (east coast for those who will pick holes in my story) I've not really noticed any changes in daily life since the start of social distancing
The other cultural greeting difference I noticed was that in Canada we'd typically say "Hi" multiple times a day to the same person, but in France, only once at the start of the day.
This aligns with my observations. You never bonjour the same person more than once per day.
Aha! Maybe I’ve not gone crazy after all! When I bonjour-ed more than once, I’d get a somewhat shocked “Dis donc!” look back.
That is not mutually exclusive
In Hungary you shake hands with absolutely everyone when you first meet them that day.
and in other news... We are shrinking... https://www.theguardian.com/world/2021/sep/17/dutch-are-worlds-tallest-people-but-theyre-shrinking-study-shows
My first thought was that it's probably a good thing. And possibly explained by either less growth hormones used in the meat/milk industry, or less consumption of those. I really don't like the tone of the article, like bigger is always better.
Experts have started saying that we have achieved COVID herd immunity in Denmark!
that's interesting. I thought you'd need something like 85-90% vaccination/previous infection rates to protect against delta
That might be the case. We have ~75% vaccinated at the moment. One difference from other European countries is the fact that we banned Astra-Zeneca/J&J and only use Pfeizer/Moderna.
is that 75% of adults or of total pop? (media is often pretty sloppy here so difficult to know)
Pfizer/Moderna seem to have different rates of effectiveness against delta, so it might make the needed rate lower. If so that is really good news. Just have to get the rest of the world up to that level now. 🙂
Just updated the github issue for using c libs in bb with the latest progress, https://github.com/babashka/babashka/issues/978#issuecomment-922076622 Clojure's support for calling c libraries is very good. There's https://github.com/Chouser/clojure-jna/ , https://github.com/cnuernber/dtype-next/ , and a newer option called https://github.com/IGJoshua/coffi Here's what it looks like using dtype-next:
(ns ffiexample.clj
(:require [tech.v3.datatype.ffi :as dt-ffi]))
(dt-ffi/define-library-interface
{:strlen {:rettype :size-t
:argtypes [['s :pointer]]}})
(strlen (dt-ffi/string->c "Hello World"))
;; 11
It even supports repl reloading and compiling with graalvm's native-image.