reveal

Docs: https://vlaaad.github.io/reveal/ Source: https://github.com/vlaaad/reveal
vlaaad 2021-04-08T07:24:04.030500Z

I’ve been thinking about that before 🙂 In general it’s not possible since we usually have repls that are unaware of reveal, e.g. how would you do that with remote prepl? Eval is in different process that has no way to access Reveal… But it’s possible to create local repls that ARE aware of reveal, and maybe built-in repl could have their eval augmented to access currently selected value.

phronmophobic 2021-04-08T07:36:05.030700Z

Some possibilities • maybe a function call that just asks reveal what its currently selected value is • a reveal command that sets a callback to be called whenever the currently selected value changes. Then I can use that callback to put the latest value wherever it's convenient • Since it's only for development, it might it even make sense to intern a var in clojure.core like *r that gets updated with the latest selection. This option would make it easier to share workflows

vlaaad 2021-04-08T07:44:28.031Z

Good suggestions! One reason I haven’t done this so far (besides higher prio stuff) is because I think there might be another way to

vlaaad 2021-04-08T07:44:39.031200Z

..oops, hit enter too fast 😄

1😆
vlaaad 2021-04-08T07:46:23.031400Z

Anyway, I think there is another issue that could be fixable with access to selection in one swoop: there is no sharing of bindings between reveal’s eval on selection and user’s repl

vlaaad 2021-04-08T07:48:13.031600Z

for example, using (prn *v) in eval-on-selection popup will print… somewhere, but not in Reveal’s UI, while using (prn :foo) with reveal-connected repl will print both to reveal and to process’ out

phronmophobic 2021-04-08T07:50:25.031900Z

does reveal know what the currently selected namespace is?

vlaaad 2021-04-08T07:50:54.032100Z

nope, and this is another problem in this area

phronmophobic 2021-04-08T07:51:10.032300Z

not sure it does, but if it did, then there could be an option to def a var in the current namespace

phronmophobic 2021-04-08T07:51:16.032500Z

oh, bummer

vlaaad 2021-04-08T07:51:17.032700Z

but I guess *ns* is a part of those bindings

phronmophobic 2021-04-08T07:51:31.032900Z

true

vlaaad 2021-04-08T07:52:22.033100Z

so if/when I figure this stuff out, maybe (def foo *v) will pick a better ns than clojure.core

vlaaad 2021-04-08T07:53:19.033300Z

like user , or ns that was active when reveal repl was started, or ns from latest eval… this needs some more hammock time

1👍
phronmophobic 2021-04-08T07:58:51.033700Z

if you don't have enough options, you could also create a reveal namespace named something short like r or reveal. Then it's easy to use from the repl with r/*v , r/my-saved-val, etc.

phronmophobic 2021-04-08T07:59:06.033900Z

you wouldn't even need to require the namespace since it would be fully qualified

phronmophobic 2021-04-08T07:59:33.034100Z

so it would work regardless of which namespace you're working in

phronmophobic 2021-04-08T08:00:40.034300Z

the main benefit is that you wouldn't have to add requires in namespaces just to access reveal values

phronmophobic 2021-04-08T08:05:39.034600Z

the main downside is that short names are more likely to clash with common aliases

vlaaad 2021-04-08T19:12:17.037200Z

I just made a bugfix release — 1.3.206 fixes 2 issues: • attempt to print cancelled future threw exceptions • attempt to open a sorted map with non-keyword keys in a results panel threw exception

5
teodorlu 2021-04-08T20:23:53.037500Z

why not just a normal namespace like reveal.repl/*v ? Optionally other namespace / other name for *v. I woudn't consider (require '[reveal.repl :refer [*v]]) in user.clj too much of a hassle. I'm assuming it's not possible to connect multiple reveal processes? Caveat: Reveal noob, this might not make sense.

phronmophobic 2021-04-08T20:31:07.037900Z

@teodorlu, for my personal workflow, I might be working in several different namespaces at once, so remembering to run (require '[reveal.repl :refer [*v]]) in each namespace I might be in adds enough friction that I probably wouldn't use it that often

wilkerlucio 2021-04-08T20:32:57.038100Z

hooking on what @teodorlu said, that could be a thing Reveal does, when the user changes the selection on reveal, reveal updates reveal.repl/*v (that value being an atom or something) to reflect that reference, maybe that’s what @teodorlu was saying

1➕
phronmophobic 2021-04-08T20:37:57.038400Z

updating reveal.repl/*v makes sense. I was hoping for a shorter name for reveal.repl/*v like r/*v

wilkerlucio 2021-04-08T23:17:08.038600Z

@smith.adriane to deal with the long names I would make a live template (aka snippet) to expand something like rv to @reveal.repl/*v