This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-10-25
Channels
- # babashka (65)
- # beginners (34)
- # biff (18)
- # calva (8)
- # clara (22)
- # clj-kondo (32)
- # clojure (24)
- # clojure-bay-area (4)
- # clojure-europe (135)
- # clojure-nl (3)
- # clojure-norway (9)
- # clojure-uk (1)
- # clojurescript (11)
- # clojutre (1)
- # core-async (8)
- # cursive (3)
- # datomic (31)
- # emacs (5)
- # fulcro (6)
- # graalvm (5)
- # graphql (3)
- # honeysql (1)
- # introduce-yourself (9)
- # kaocha (1)
- # lsp (65)
- # meander (5)
- # nbb (7)
- # nrepl (2)
- # off-topic (44)
- # rum (3)
- # shadow-cljs (23)
- # specter (1)
- # tools-deps (6)
- # vim (3)
- # xtdb (30)
Morning
Good morning 🙂
Yeeees? Inconsistency was not enough reason? (It is to me!)
I mean, I get that there might be more important things to worry about than abstractions over the host language leaking here and there when language users do weird things… But, like you said, why should anyone expect having to deal with an undocumented exception in one case, and not the other?
it's interesting. sorted-set
behaves like a homogenous set, whereas set
behaves heterogenous... but sorted-set
implies homogeneity (or at least the ability to compare
all pairs of elements)
it seems more reasonable that (conj (sorted-set 0) "")
should fail
i have to admit that i'm very used to the idea that get
is safe and should never fail harder than returning nil
So, I think I consider myself a Clojure programmer (that’s stupid, you shouldn’t be married to tech, they say), and also a Clojure advocate if not evangelist. I present at (non-clojure) conferences saying that Clojure is the greatest thing since sliced bread, and that dynamic typing actually works in real life, in production. In doing so, I don’t really want to be met with/having to defend stuff like:
user> (get {9 0} :wat)
;; => nil
user> (get "wat" :wat)
;; => nil
user> (get nil :wat)
;; => nil
user> (get 9 :wat)
;; => nil
user> (get (hash-map 0 9) :wat)
;; => nil
user> (get (sorted-map 0 9) :wat)
Execution error (ClassCastException) at user/eval573567 (form-init8054768168167100120.clj:27117).
class java.lang.Long cannot be cast to class clojure.lang.Keyword (java.lang.Long is in module java.base of loader 'bootstrap'; clojure.lang.Keyword is in unnamed module of loader 'app')
user>
And, I’d be very happy to settle for yes, it’s a bug, but we ain’t fixing it anytime soon.
There was something unspoken about this that was bothering me, too, and I think I’m with you. The language implementor attitude towards things like this can make all the difference.
Or, at least, a lot of difference 🙂
I think I’ve seen other, similar examples of unexpected exceptions due to abstraction leakage, with similar responses.
I think it's a little bit of hubris mixed, a little bit of "meh, no big deal", mixed with a slightly obsessive attitude towards maintaining backwards compatibility in every respect.
dynamic != weak typing 👀 also, some ex-colleague would humorously use the expression "bag of shit" to describe anything-goes-in hashmaps. I ended up feeling the same - hashmaps are cool but bags o' shit aren't
Good morning!
This was from last night but it has the same mist that you get at dawn so I think it still works for a morning shot :)
I like how you often get some interesting path through your photos, @U04V5V0V4. I've gotten inspired and think of it when I take a picture of something. It's fun to just experiment a bit with the perspectives, and also I notice that I start to see my surroundings more in this light. ”That's a nice line towards the horizon” and similar.
Is this something you think about when you take pictures, or does it just happen that way?
Yes, I do think about that. I'm a big fan of Nigel Danson who is an amazing and generous landscape photographer (that was in software before he turned pro) https://www.youtube.com/watch?v=XTuw_KvMY7U
I just got my plane tickets 😁 I'm in Amsterdam Friday to Monday. Staying in a hotel near the event. No plans other than Saturday.
My family schedule doesn't allow for much travelling at the moment but I'm looking forward meeting you all again eventually!
I think it is this: https://www.techradar.com/news/got-an-intel-laptop-be-warned-new-linux-bug-can-literally-break-your-screen
(ubuntu stable 20 + liquorix kernel, still in the setting up phase and was stuck in setting up nvidia gpu driver last month, reverting to backup kernel/changing to llvmpipe doesn’t seem to help either)
reading how that bug can cause physical damage to the hardware, I dare not even boot up my laptop now…
Unpopular opinion: the stack traces are just fine,I don't see what the problem is, and I knew zero java coming in to Clojure
I was definitely confused in the beginning, but now it’s blondes, brunettes, redheads…
I remember first doing some Haskell: some of the type warnings weren't particularly beginner friendly either :P
I think the presentation of stackframes is the problem. the fact that you can deduce exactly the "path" the execution of your code took is actually beginner friendly.
My microcontroller code written in C will typically just fail with random unexpected behaviour.
I also liked that you could inspect the source of core functions, especially in the beginning
oh, yes!
Agree, "here's exactly how you got to something exploding in your face" is actually great The only conclusion is people panic and don't just stop and read the damn traces. Slowly
close and slow reading is one of the more frustrating things to learn in clojure coming from more verbose languages
I think the stack traces are fine as long as you know Java or Javascript or whatever host platform you're on, but there's no doubt in my mind that it's a significant hindrance to anyone who hasn't already done enough to Java to understand what's going on. It's basically a path dependency of being a hosted language, so the issue can never truly be resolved.
I actually (ab)used Clojure to learn more about the JVM (as Java was a too boring language to me)
if you compare them to rust, elm & co, sure. Otherwise they are just on par with most mainstream languages
personally I don't mind having too much info, you can always filter out what you don't need at another level
The lowest hanging fruit must surely be some more descriptive error messages for those "x can't be cast to IFn" and the like that are actual problems for beginners. There is some obvious tension created by Clojure's dynamism inside the Java host, but forcing people to find what the hell an IFn is, is really jusy forcing people to both learn Java and examine how Clojure is implemented before being able to use Clojure. Maybe it's a feature, not a bug? I dunno.
What is meant by https://clojurians.slack.com/archives/CBJ5CGE0G/p1666703246217989?thread_ts=1666702845.935019&cid=CBJ5CGE0G is that there aren't any beginner friendly checks in the cast-paths because of performance. People who see this error usually know what it means, unless you're a true beginner
This is one problem that a statically typed programming language doesn't have because these checks happen at compile time rather than at run time
I personally think the error message is a thing you get over quickly. Clojure might not be optimized to be a first language to teach, but given the bandwidth clojure core has it's more than ok
I'd rather have stuff like creepingly slow satisfies? & co fixed than more work on error messages
With forms being read by the REPL, it's more difficult to give a nice printout of the offending code with "here's where bad things happened"
We need something file-independent which keeps history. Basically copy what Unison did?
My issue was that my iMac is getting old. Old enough to stop running certain programs or give dire warnings when doing so. So I'm switching my iMac to run Linux.
@mpenet no reason to be single threaded, what did you mean by value vs. type when using satisfies?
you don't have to create a shim protocol function just to indicate a thing implements a protocol
just replace (if (satisfies? That thingy) then else)
with (extend-protocol That Object (-method [this] else))
That's what I was aiming at. Why is it a workaround? It results in cleaner and more straight forward call site
so basically you must make it a nilable (by extending Object to return nil) and check the ret nil for cases where you don't want to have one
(defn inst?
"Return true if x satisfies Inst"
{:added "1.9"}
[x]
(satisfies? Inst x))