Fork me on GitHub
#humbleui
<
2024-02-06
>
yuhan10:02:10

Are there any example setups out there integrating HumbleUI with a Cider/cider-nrepl workflow? I've managed to start up an nrepl server from the main ns, but for example this doesn't afford the use of Cider's tooling to analyse stacktraces of exceptions thrown from the UI thread.

Niki13:02:17

Do you know why? Is there a problem specific to Humble UI or it’s just the fact that they originate from another thread?

yuhan15:02:27

I'm not too familiar with the internals of nREPL but pretty sure it's the latter

yuhan15:02:04

There's probably a way to take the *e value and pass it to the relevant nrepl op, to manually simulate what would 'normally' happen with all clojure code evaluations passing through Cider's middleware

yuhan15:02:21

HumbleUI seems like a exciting and really promising approach, but the last couple of hours trying to take it for a spin have felt frustratingly opaque given the lack of documentation and tooling support :face_with_diagonal_mouth: (of course I realise the caveats of it being pre-alpha software that dev UX probably isn't a big priority for now)

Niki15:02:15

Yep, and the fact that I don’t use nREPL or Cider probably doesn’t help either

Niki15:02:36

In my setup errors are just printed to console

yuhan15:02:02

yeah, also a lot of my errors at the start were of the fatal REPL-crashing kind, I think due to wrong types of arguments being passed to functions, eg.

# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00000001615d6be0, pid=22112, tid=259
#
# JRE version: OpenJDK Runtime Environment Temurin-21.0.2+13 (21.0.2+13) (build 21.0.2+13-LTS)
# Java VM: OpenJDK 64-Bit Server VM Temurin-21.0.2+13 (21.0.2+13-LTS, mixed mode, tiered, compressed oops, compressed class ptrs, g1 gc, bsd-aarch64)
# Problematic frame:
# C  [libskija.dylib+0x12be0]  Java_io_github_humbleui_skija_TextLine__1nGetTextBlob+0x0
#
# No core dump will be written. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#

yuhan15:02:19

not sure if these can be made recoverable

Niki16:02:15

Yeah, no, this is unrecoverable. I should put more checks before interfacing with Skia. Basically this is simple null pointer but because it was passed to native it unrecoverably died

yuhan16:02:58

As a concrete example for feedback, I spent a good chunk of time trial-and-error debugging these fatal crashes just trying to write a minimal "Hello world" from the ground up ... it turned out that I hadn't wrapped the overall UI in default-theme, I guess causing the crash due to uninitialized attributes.

Niki16:02:14

Yeah, that’s a common gotcha. Will think what to do with it

yuhan16:02:07

Another nit related to dev tooling - the import-vars macro adds a lot of friction jumping to the implementation of any of the core API functions from their call sites - something I often did when trying to understand them due to lack of docstrings

Niki16:02:54

Interesting, thanks!

yuhan16:02:11

btw Potemkin's version of import-vars works out of the box, Cider tooling reports and jumps straight to the original definition

Niki16:02:31

Also interesting

yuhan17:02:38

also poked around in the vdom branch where it seems to use even more unconventional way of splitting up the ns into multiple files - clj-kondo's static analysis doesn't recognize any of this and throws up a bunch of linting errors