Fork me on GitHub
#hyperfiddle
<
2023-09-15
>
Panel00:09:26

Can e/def be inspected at the repl ?

Dustin Getz01:09:20

not really, you can deep def or you can use the test electric entrypoint in an RCF test

Dustin Getz01:09:53

the problem is that electric anything can only be resolved from an electric program (not valid in clojure as clojure is not aware of electric) so to use the REPL you have to bring your own electric entrypoint (see our unit tests)

joshcho00:09:16

I sometimes get Unable to resolve symbol errors that are really hard to pin down. Why does this occur?

joshcho00:09:25

I suspect it's because of incorrect require, or something along those lines? I have faced it being really confused why the symbol isn't being resolved, only to realized that there is some error regarding compilation somewhere else.

Dustin Getz01:09:57

post an example stacktrace please

Dustin Getz01:09:38

a common gotcha (that i’ve been meaning to improve) is when a stale browser tab reconnects to a fresh server, especially a stale tab from an entirely different electric app, which will (because the DAG is initialized by the client) start resolving stuff on the server classpath that isn’t there

👍 2
joshcho01:09:12

This is totally not helpful, but I posted this after I resolved the problem a couple hours ago. I don't think I can reproduce it. Sorry about that. I will return to this if I face something like it again.

👍 1
Dustin Getz01:09:29

i also don’t yet trust shadow-cljs setups that are not explicitly booted by the app/repl via the clojure shadow API, see the documented shadow setup in the starter app user.clj

joshcho01:09:23

Hm, so the one via cider is not trustworthy?

Dustin Getz01:09:03

in theory the editor plugins can work but i’ve seem unstable compilation happen with them in ways i don’t understand, what i know for certain is that when i explicitly control compilation i have zero issues

Dustin Getz01:09:33

im working on understanding calva better , hope to have a validated calva setup soon that is more tightly integrated than “run shadow from user.clj” but i haven’t had time yet to go deep

joshcho01:09:21

yeah I have seen things happen where I'd restart emacs and compilation errors would go away.

joshcho03:09:01

@U09K620SG Came across this much more quickly than I would have liked...

joshcho03:09:00

Oh, maybe I am looking at the wrong stacktrace! A trace above it was the answer.

joshcho03:09:53

Is there any way to make these traces more sane? They are quite long.

👍 1
xificurC06:09:14

maybe you can prettify and collapse the non-interesting parts with https://github.com/clj-commons/pretty

❤️ 1
Dustin Getz10:09:37

yes , we do need to review the common sources of compiler and runtime errors to elide stack frames that aren’t from userland. this is actually really easy - “good first issue” easy if you are interested in taking a whack?

Dustin Getz10:09:59

many of the common errors can be reduced to 1 line probably

❤️ 1
Dustin Getz10:09:17

the other thing that might help is to develop or find a mechanism for using spec to validate syntax at certain places (before macroexpansion adds distance between what the user typed and the actual code that crashed), this would be a later pass after the first

❤️ 1
telekid13:09:04

> “good first issue” easy if you are interested in taking a whack Where roughly would one start looking?

Dustin Getz18:09:13

Next time you see a stack trace with electric compiler or electric runtime internals, first observe that internals traces have no value to the end user who only cares about userland. so a starting point is to sever the useless info. If you look at how clojure.core's ex-info is implemented, they have code to sever the top few frames, which is basically what you want here

Dustin Getz18:09:49

Really the hard part (from my perspective) is running like that for a while to be confident that this is the right thing to do, and to start mapping out all the places where this might be desirable, there are only a few places in electric where user land code is evaluated and they all should be pretty obvious and already have a try/catch around them

👍 1
joshcho04:12:10

u guys are legends