cljs-dev

vemv 2023-07-27T18:44:01.358379Z

It would seem very much handy for tool makers if the cljs analysis (i.e. the object that has a :cljs.analyzer/namespaces key, among others included a :form when descring a var e.g. I'm asking for a :form to be associated here:

{:meta {,,,},
 :form (def foo 42) ;; <--------------
 :name shadow.remote.runtime.api/foo,
 :file "shadow/remote/runtime/api.cljc",
 :end-column 30,
 :column 8,
 :line 13}
is this a FAQ / something you'd consider?

thheller 2023-07-27T19:25:56.486479Z

you should be able to get that from the line/col metadata? well the string at least. https://github.com/clojure/clojurescript/blob/1b6d4e559bfaa716052c557f6fa31111384eb336/src/main/clojure/cljs/repl.cljc#L1495

vemv 2023-07-27T20:02:08.109279Z

thanks! Good leads, I'l try making use of those

vemv 2023-07-27T20:06:02.680639Z

An edge case being, forms defined at the repl / interactively, those cannot be fetched from source+line+col Given that those would be like < 1% off all cases, it would not be memory-expensive to include them

thheller 2023-07-27T20:08:03.555069Z

well there is also the extra concern for cache related things

thheller 2023-07-27T20:08:34.888489Z

currently this data is written to disk as transit per namespaces (for shadow-cljs at least)

thheller 2023-07-27T20:08:57.212589Z

which would also cost performance I guess

thheller 2023-07-27T20:10:05.025889Z

what would you do with the form in the first place though? should probably first provide a proper use case before anything is decided 😛

vemv 2023-07-27T20:19:27.487659Z

Thanks. The use case would be "arbitrary tooling stuff". The usual suspects: offering better completions, refactorings, info, and such.

thheller 2023-07-27T19:33:32.497519Z

otherwise it might increase memory use? and may contain not easily serialized stuff, e.g. regexes are not part of EDN or transit by default