-
-
Notifications
You must be signed in to change notification settings - Fork 645
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using load-file
to emulate source-tracking eval will not work with piggieback 0.2.1
#1088
Comments
I haven't merged the patch on NREPL-59 yet because I've continued to unravel the consequences of the ClojureScript REPL redesign from a couple months ago. The change in piggieback 0.2.1 is a part of this. It's really a fundamental break from the contract of the There's lots of background I could go into with more time, but the tl;dr is that the "supported" API to the ClojureScript REPL offers two options: load files from disk (with line/column metadata), or evaluate expressions interactively (without such metadata). A lot of this flows from the demands of source maps and the whole-file expectations of REPL environment impls, key default implementations of the various REPL environments protocols, (and more fundamentally) the fact that ClojureScript straddles two contexts: compiler in JVM, runtime "over there" (note that this doesn't change even given a node-hosted compiler, as such a thing would continue to architecturally support dumping compilation output and source maps for consumption by a separate JS env). Anyway, for any particular "edge case" compiler-dependent interaction like this, there's always the option of interfacing directly with the ClojureScript compiler…which piggieback did in the past, and which did not work out so well as it (me) was outpaced by upstream changes. Being able to say that piggieback works with and reuses Absent someone stepping up to that role (or getting upstream to take patches to support this or whatever other "edge case" interactions come up), I'd suggest simply not attempting to support source tracking of file-sourced expression evaluations. |
Thanks for the quick and detailed response! Yeah, I agree that the moving from using internals like I understand what you mean by things like source maps (and just how CLJS REPLs work more like an interface to the compiler than an actual dynamic runtime) make doing this difficult in CLJS (possibly more so than it is worth). It's also worth considering that with the advent of the So perhaps, we should just focus on source-tracking eval in nREPL only. The @bbatsov any thoughts on what to do in the meantime? |
You're not.
My take is that the current situation is pretty problematic and I'll take source-tracking implemented in nREPL over our current hack any day of the week. While feature parity between nREPL & piggieback is highly desirable, our inability to ensure it right now shouldn't be the obstacle to adding support for this in nREPL. |
@cichli Interesting that cider saves as a side effect of a file load. (I make a habit of not changing my emacs setup.) That's sort of unfortunate IMO, but I might be idiosyncratic in that opinion. |
Technically, it asks you to save the file before loading it, which is pretty reasonable IMO. An there's an option you added a while back to simply save the file automatically instead of asking to do so. |
How embarrassing, so I did. #469. I have no recollection of it, but there it is, and the setting remains in my |
We'll forget all about it if you merge NREPL-59. ;-) |
Seems this is now the only showstopper for CIDER 0.9. I doubt anything will be changed in nREPL soon, so we're left with one of two unpleasant options:
So, what should we do? |
The upshot of my prior comment was effectively the second of your options. Unpleasant or not, I don't expect piggieback to ever support source-tracking eval, NREPL-59 or not. |
@cemerick If we merge NREPL-59 we can just kill this hack altogether. This will work on Clojure and won't work on ClojureScript, which is fine by me. Beats having a conditional hack any day of the week. |
Not to mention it will remove all the confusing |
Btw, @swannodette, what's your take on all of this? |
@bbatsov no strong opinions since I'm not an active Cider user. Even after reading this whole thread and the related links I'm not sure what ClojureScript needs to do to support this. |
@swannodette Well, this is not an CIDER issue, per se. The problem is that any REPL-based ClojureScript tool can't keep track of the var definition locations, as you cannot pass this location somehow to the ClojureScript REPL at the moment. This is the most relevant part of the discussion for you. @cemerick can't find a simple way to implement the definition location tracking in piggieback, which blocks us from implementing it in nREPL and CIDER respectively.
|
@bbatsov there's just nothing for me to do here yet. Someone else needs to describe something actionable for ClojureScript like enumerating implementation strategies and their tradeoffs. I'm more than happy to sort through ideas once they are in a presentable form and guide someone else's work on a patch to ClojureScript. |
Fair enough. |
See nrepl/piggieback@46e30fd. The
file
slot is now ignored, and instead the contents offile-path
are always loaded from disk. This means that the interactive eval commands that rely onload-file
will not do the expected thing at all when using piggieback 0.2.1.I guess, ideally, the source-tracking eval patch (or something equivalent) will be merged to nREPL, and then the equivalent changes made in piggieback also - but I think this will potentially require upstream changes in ClojureScript itself. The string
<cljs repl>
is passed as the file name in a lot of places incljs.repl
, so piggieback would need some way of dynamically binding this.Paging @cemerick... any thoughts on this?
The text was updated successfully, but these errors were encountered: