conjure icon indicating copy to clipboard operation
conjure copied to clipboard

[FR] Context aware evaluation

Open glyh opened this issue 1 year ago • 8 comments

In https://github.com/liquidz/vim-iced, there's so-called context aware evaluation, you can evaluate any inner range of any bindings, but it is required for user to provide value for those bindings. This could be useful when debugging a function for example.

This is harder than other feature to implement because it requires conjure to "understand" the code.

Some easier alternative may be only allow context aware evaluation for a whole function, then we may piece some code together to emulate a function call.

glyh avatar Jun 19 '23 04:06 glyh

Hm, interesting idea, sounds quite tricky to implement though, stepping way out of the boundaries of problems I want to tackle with Conjure. I think I'd prefer to work on clojure-dap (https://github.com/Olical/clojure-dap) and push people to use that wherever they need to override values mid-eval and inspect things. I want DAP and LSP to compliment Conjure so Conjure can stay focussed on just selecting forms for eval and showing results in a notebook like way with the log.

I'll keep this in mind, it may be a good fit, but it sounds hard and I have MANY fish to fry at the moment. I have to choose battles wisely, in the interests of time today but also in their potentially massive maintenance costs in the future. This could be yet another good fit for delegation into a 3rd party plugin that hooks into Conjure's internals to provide this feature.

On Mon, 19 Jun 2023 at 05:27, Yihang Liu @.***> wrote:

In vim-iced, there's so-called context aware evaluation, you can evaluate any inner range of any bindings, but it is required for user to provide value for those bindings. This could be useful when debugging a function for example.

This is harder than other feature to implement because it requires conjure to "understand" the code.

Some easier alternative may be only allow context aware evaluation for a whole function, then we may piece some code together to emulate a function call.

— Reply to this email directly, view it on GitHub https://github.com/Olical/conjure/issues/508, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACM6XL4JTWG55JZLPFGV7DXL7IJFANCNFSM6AAAAAAZLLS72U . You are receiving this because you are subscribed to this thread.Message ID: @.***>

Olical avatar Jun 21 '23 09:06 Olical

I guess you can transfer this to https://github.com/Olical/clojure-dap then?

glyh avatar Jun 21 '23 09:06 glyh

Well, not sure if the exact feature translates. Debuggers allow you to break in a point and then change the surrounding context. Not sure if they let you do this, like evaluating code with all things it requires defined JIT by the user.

I also have a feeling I implemented this using a feature in CIDER...

Olical avatar Jun 21 '23 09:06 Olical

Ah it's completion I was thinking of. That requires you to substitute some stuff to allow completing local values from a let block. That was super fiddly too and felt like it only worked half of the time. Then I just started to lean on LSP for 90% of my completion and the issues melted away for me, personally.

Olical avatar Jun 21 '23 09:06 Olical

Okay, let me just close this. I guess if one day if I find a proper place I can open it there. As you said this is too complicated in that it's beyond merely interacting with nREPL.

glyh avatar Jun 21 '23 09:06 glyh

I like the idea and I think it'd be useful, just hard. So I'm open to it, it's just going to be down in my priority queue due to the complexity and that I personally see it as a "nice to have" because I don't have the habit of requiring it already. Tree sitter makes this easier, but you still need to essentially parse that tree / understand it as you walk it.

On Wed, 21 Jun 2023 at 10:38, Yihang Liu @.***> wrote:

Closed #508 https://github.com/Olical/conjure/issues/508 as completed.

— Reply to this email directly, view it on GitHub https://github.com/Olical/conjure/issues/508#event-9591043207, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACM6XM62LU5UHZMDNHILM3XMK6J5ANCNFSM6AAAAAAZLLS72U . You are receiving this because you commented.Message ID: @.***>

Olical avatar Jun 21 '23 09:06 Olical

@Olical I just wanted to point out vim-iced implements this by using the feature from CIDER. Here is the original CIDER issue where it was first raised and the commit where it was implemented. Sorry to bump and old issue that's already marked as closed, but I thought it might be helpful context.

sheluchin avatar Oct 15 '23 18:10 sheluchin

Fair point! Forgot about that feature, I'll take another look at some point. Or work with someone who'd like to contribute the feature.

Olical avatar Oct 16 '23 10:10 Olical