This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-02-14
Channels
- # announcements (7)
- # babashka (13)
- # beginners (98)
- # biff (20)
- # calva (3)
- # clj-kondo (5)
- # clj-otel (6)
- # cljs-dev (96)
- # clojure (22)
- # clojure-austin (30)
- # clojure-conj (4)
- # clojure-europe (53)
- # clojure-nl (2)
- # clojure-norway (63)
- # clojure-uk (3)
- # clojurescript (18)
- # cursive (10)
- # data-science (11)
- # datalevin (2)
- # datomic (7)
- # deps-new (1)
- # fulcro (3)
- # graphql (1)
- # gratitude (4)
- # hyperfiddle (43)
- # kaocha (4)
- # malli (15)
- # pathom (6)
- # polylith (2)
- # reagent (3)
- # reitit (2)
- # releases (6)
- # remote-jobs (1)
- # rewrite-clj (45)
- # ring (4)
- # shadow-cljs (47)
- # sql (5)
- # xtdb (8)
Does babashka not respect toString
?
@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.
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
It seems that for defrecord it does work in bb:
user=> (defrecord Dude2 [] Object (toString [_] "dude2"))
user.Dude2
user=> (.toString (->Dude2))
nil
user=> (str (->Dude2))
"dude2"
but like we saw yesterday, the java interop doesn't work properlyI pushed the toString fix with str
to master now, still need to look into the interop case
Oh wow, cheers! That was fast.