Fork me on GitHub
Jakub Šťastný17:02:48

Does babashka not respect toString?


Seems like a bug, issue welcome

Jakub Šťastný17:02:37

@U04V15CAJ is what I'm doing with print-method and toString not commonly used? I'm surprised about this toString bug, so it makes me think I'm probably doing something that's not overly common? Otherwise someone would surely discover it by now.

Jakub Šťastný17:02:26

Like I'm coming from Ruby/JS and in Ruby it's very common to define its variant of toString (`inspect` and to_s) for objects. So I wonder whether it's much of a pattern in Clojure, but since it's supported...


deftype isn't frequently used, only for very low level constructs. avoid it if you don't need it


The mantra in Clojure is "just use maps"

👍 2

It seems that for defrecord it does work in bb:

user=> (defrecord Dude2 [] Object (toString [_] "dude2"))
user=> (.toString (->Dude2))
user=> (str (->Dude2))
but like we saw yesterday, the java interop doesn't work properly


I pushed the toString fix with str to master now, still need to look into the interop case

Jakub Šťastný17:02:54

Oh wow, cheers! That was fast.


yeah, it was just a typo somewhere


When the current build finishes, you can install the new version with:

bash <(curl ) --dev-build --dir /tmp