vvvvalvalval / scope-capture

Project your Clojure(Script) REPL into the same context as your code when it ran
MIT License
573 stars 14 forks source link

Support for naming code sites #35

Open npetryk opened 5 years ago

npetryk commented 5 years ago

First of all, awesome library that has been incredibly useful! Thanks for all of yall's work

I was thinking that a very useful feature would be to provide names (keywords, most likely) for code sites. Combined with something like last-ep-id this would give you the ability to refer to & debug arbitrary points in your code very easily and without the user having to fiddle with the integer arguments.

My particular motivation is that I have a series of transformations in a big ->> which I scatter with (#(do (def some-name %) %))s. I then shove the captured data into https://github.com/lambdaisland/deep-diff to very clearly see what each transformation step does.

Using spyqt & ep-value for this seems like a no brainer, except for the somewhat tedious cross referencing required to get the call site ids. FWIW this may be useful for #34 in that they could search for the most recent execution id for a specific call site more easily.

Happy to take a crack at it myself in a PR if you'd like to give me your 2 cents about this. Obviously the names would no longer be unique as the integer ids are, and I dont know if this would be an issue for the library.