Fork me on GitHub
#clojure-europe
<
2022-10-25
>
Thierry06:10:27

👋 morning

dharrigan07:10:33

Good Morning!

reefersleep07:10:13

Good morning 🙂

slipset07:10:09

I still cant let the sorted set thing go… It still annoys the hell out of me.

slipset07:10:15

And I’ve figured out why.

reefersleep08:10:03

Yeeees? Inconsistency was not enough reason? (It is to me!)

reefersleep08:10:49

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?

genRaiy08:10:12

Please share

simongray09:10:49

The suspense is killing us!!

mccraigmccraig09:10:12

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

slipset10:10:28

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> 

🦆 1
slipset10:10:51

And, I’d be very happy to settle for yes, it’s a bug, but we ain’t fixing it anytime soon.

reefersleep10:10:15

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.

reefersleep10:10:58

Or, at least, a lot of difference 🙂

reefersleep10:10:15

I think I’ve seen other, similar examples of unexpected exceptions due to abstraction leakage, with similar responses.

simongray11:10:29

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.

simongray12:10:42

But lately they do seem to fix more of these papercuts

vemv12:10:49

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

genRaiy08:10:14

Good morning

genRaiy08:10:23

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 :)

9
teodorlu08:10:30

are you sure you’re not a professional photographer impersonating ray?

otfrom09:10:48

obviously you should flip it so the sun is in the right position though. 😉

genRaiy09:10:47

I’m an idiot :man-shrugging::skin-tone-2:

pez10:10:02

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.

💯 1
pez10:10:24

Is this something you think about when you take pictures, or does it just happen that way?

genRaiy11:10:34

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

👍 1
👀 1
robert-stuttaford10:10:04

super lookin forward to seeing some of you this weekend!

👍 1
borkdude10:10:22

who is coming to Dutch Clojure Days? 🧵

teodorlu10:10:07

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.

genRaiy10:10:52

👍:skin-tone-3:

ordnungswidrig13:10:32

My family schedule doesn't allow for much travelling at the moment but I'm looking forward meeting you all again eventually!

vijaykiran19:10:11

I’m on #C047C0BE3HC

💯 1
lemontea12:10:35

seems I bricked my secondary Linux laptop

😬 1
1
😭 1
🧱 1
lemontea12:10:05

(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)

lemontea12:10:42

reading how that bug can cause physical damage to the hardware, I dare not even boot up my laptop now…

😞 1
lemontea12:10:12

…maybe I should just declare today to be “Black Tuesday” and call it a day

Ben Sless13:10:45

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

👍 5
❤️ 1
otfrom13:10:42

I like stack traces too, but I did java for ages.

reefersleep13:10:48

I was definitely confused in the beginning, but now it’s blondes, brunettes, redheads…

😄 2
borkdude13:10:47

I remember first doing some Haskell: some of the type warnings weren't particularly beginner friendly either :P

borkdude13:10:26

"Clojure is optimized for correct programs" - Stu Halloway

ordnungswidrig13:10:45

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.

ordnungswidrig13:10:19

My microcontroller code written in C will typically just fail with random unexpected behaviour.

borkdude13:10:42

I also liked that you could inspect the source of core functions, especially in the beginning

Ben Sless13:10:32

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

otfrom13:10:50

close and slow reading is one of the more frustrating things to learn in clojure coming from more verbose languages

1
borkdude13:10:39

I love the information density of Clojure

simongray13:10:22

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.

borkdude13:10:57

I actually (ab)used Clojure to learn more about the JVM (as Java was a too boring language to me)

mpenet13:10:24

if you compare them to rust, elm & co, sure. Otherwise they are just on par with most mainstream languages

mpenet13:10:02

personally I don't mind having too much info, you can always filter out what you don't need at another level

simongray13:10:34

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.

borkdude13:10:50

What is meant by https://clojurians.slack.com/archives/CBJ5CGE0G/p1666703246217989?thread_ts=1666702845.935019&amp;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

1
borkdude13:10:54

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

borkdude13:10:12

Unless you build a dynamic programming language in them 😈

mpenet13:10:05

well luckily we have some level of static analysis available through external tools

mpenet13:10:20

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

👍 1
mpenet13:10:19

I'd rather have stuff like creepingly slow satisfies? & co fixed than more work on error messages

Ben Sless13:10:22

this is OT but why would you ever use satisfies? and not just extend?

mpenet13:10:10

type vs value

mpenet13:10:17

they act on different things

Ben Sless13:10:22

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"

Ben Sless13:10:36

We need something file-independent which keeps history. Basically copy what Unison did?

lread13:10:13

Good morning:penguin:🐧🐧🐧🐧🐧🐧🐧appleincappleincappleinc

Ben Sless13:10:22

We're winning

lread13:10:50

Slowly... migrating... old iMac... from... appleinc ... to... 🐧

Ben Sless13:10:43

Loading your computer with penguins, please stand by

genRaiy16:10:40

I use MacOS and Linux on the daily using Synergy

genRaiy16:10:59

It’s total crap on MacOS though

lread17:10:47

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.

Ben Sless13:10:16

@mpenet no reason to be single threaded, what did you mean by value vs. type when using satisfies?

mpenet13:10:59

just reading the docstring of extends? (which I actually never used)

mpenet13:10:03

> "Returns true if atype extends protocol"

mpenet13:10:19

> "Returns true if x satisfies the protocol"

Ben Sless13:10:42

I meant, (extend-protocol YourProtocol Object ..)

mpenet13:10:56

I didnt' read the source but I assume atype means ex java.util.Date and not a (Date.)

mpenet13:10:10

ah yeah, it's the current workaround

mpenet13:10:17

it's just a bit ugly

Ben Sless13:10:23

Is it a workaround?

mpenet13:10:31

Stuff (does-stuff? true)

mpenet13:10:42

vs (satisfies Stuff x)

mpenet13:10:03

you don't have to create a shim protocol function just to indicate a thing implements a protocol

mpenet13:10:14

you can also use protocols as markers (no functions needed)

Ben Sless13:10:19

you don't need a predicate at all

Ben Sless13:10:50

just replace (if (satisfies? That thingy) then else) with (extend-protocol That Object (-method [this] else))

Ben Sless13:10:15

provide the else clause on the extend to Object case

mpenet13:10:34

yes that's also one way

Ben Sless13:10:21

That's what I was aiming at. Why is it a workaround? It results in cleaner and more straight forward call site

mpenet13:10:34

hmm not really

mpenet13:10:48

imagine a function that returns an async-context

mpenet13:10:26

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

mpenet13:10:38

vs doing a check on "does this type supports this behavior"

mpenet13:10:55

I personally think it's workaround

mpenet13:10:55

I guess that's also why satisfies? exists in the first place (albeit, super slow)

mpenet13:10:12

also you can't do marker protocols with what you described

Ben Sless13:10:44

I've seen marker interfaces, not marker protocols

mpenet13:10:50

it's used by core

mpenet13:10:57

I think spec2 has some

mpenet13:10:01

at the very least

Ben Sless13:10:08

In the case you describe, I'd extend to object to return an async context as well

Ben Sless13:10:23

and I don't like that inst? uses satisfies?

mpenet13:10:32

didn't know

mpenet13:10:42

anyway, there's no reason for satisfies? not to be much faster

Ben Sless13:10:48

(defn inst?
  "Return true if x satisfies Inst"
  {:added "1.9"}
  [x]
  (satisfies? Inst x))

mpenet13:10:53

that should be a non-issue, it's just historical at this point

mpenet13:10:08

ah yeah 😕

Ben Sless13:10:09

Oh I absolutely agree, but I do feel that calling satisfies? is an anti-pattern of sorts

Ben Sless13:10:39

It's great for interactive development and exploration, but why should it exist in a library or application?