This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-05-09
Channels
- # announcements (3)
- # beginners (61)
- # biff (20)
- # cider (13)
- # clerk (6)
- # clojure (58)
- # clojure-brasil (5)
- # clojure-europe (30)
- # clojure-nl (1)
- # clojure-norway (10)
- # clojure-uk (5)
- # clr (25)
- # core-async (2)
- # cursive (19)
- # datahike (5)
- # datalevin (1)
- # docker (1)
- # emacs (3)
- # fulcro (4)
- # hoplon (3)
- # hyperfiddle (91)
- # java (2)
- # juxt (5)
- # london-clojurians (1)
- # lsp (38)
- # malli (12)
- # nrepl (9)
- # off-topic (7)
- # polylith (15)
- # portal (49)
- # rdf (2)
- # re-frame (43)
- # releases (2)
- # shadow-cljs (30)
- # spacemacs (15)
- # sql (36)
- # tools-build (20)
- # xtdb (3)
I think Cursive isn't recognizing deftype field access when the fields have a "-" in them. It doesn't complain about the fields without dashes, and the type hint doesn't help.
? The code works just fine
Without the type hint, I get a reflection warning, but that's it.
I thought this is about such code in CLJ
(deftype HttpFile [-chunk-size])
(.-chunk-size (HttpFile. 1))
Execution error (IllegalArgumentException) at user.playground/eval28391 (playground.clj:230).
No matching field found: chunk_size for class user.playground.HttpFile
The field is called chunk-size
, not -chunk-size
.
.
calls it as a method, .-
retrieves the value of the field
That should work, Cursive does understand that syntax for class fields. Is this CLJ, CLJS or CLJC?
@U0567Q30W CLJ. It's aleph.http.core
. There's two uses, and afaict, Cursive doesn't understand either, though it does understand the other fields in the HttpFile type. My guess was the hyphen was the cause, but ¯\(ツ)/¯
@U0567Q30W Any updates?
There’s definitely something odd there. Most of those are working, e.g. from HttpFile
. However, .-chunk-size
does not work, for some reason.
Ah, I think I have found the problem. .-chunk_size
does work, because that’s what the actual field is called.
Ah, I see I didn’t read your first message closely enough, I thought you were saying that the .-field
access method didn’t work, but plain dot access (`.field`) did. Either way, I’ll fix that.
https://github.com/cursive-ide/cursive/issues/2797, this is fixed for the next build.
> Ah, I see I didn’t read your first message closely enough, I thought you were saying that the .-field
access method didn’t work, but plain dot access (`.field`) did.
No, that was the other person. I think they were confused. But I was talking about dashes after the field start.
Thanks for fix!