Skip to content
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

Support custom nrepl ops for different evaluation styles #5

Open
jaidetree opened this issue Dec 12, 2018 · 5 comments
Open

Support custom nrepl ops for different evaluation styles #5

jaidetree opened this issue Dec 12, 2018 · 5 comments
Labels
enhancement New feature or request

Comments

@jaidetree
Copy link

jaidetree commented Dec 12, 2018

Problem

What if I'm in my editor and I want to send some forms to REBL and some only to the REPL?

Proposed Solution

If we create custom nrepl ops we can allow editors and users to select which forms they want to send to REBL.

For instance setting up an additional, separate key binding to eval a top level form in REBL.

Related Resources

@RickMoynihan RickMoynihan added the enhancement New feature or request label Dec 13, 2018
@RickMoynihan RickMoynihan changed the title [FEATURE] Support custom nrepl ops for different evaluation styles Support custom nrepl ops for different evaluation styles Dec 13, 2018
@RickMoynihan
Copy link
Owner

What custom ops do you suggest?

I was thinking:

  • rebl-start-ui (already implemented) calls (rebl/ui) for you.
  • rebl-toggle-follow (would require cognitect to give us a hook for this) equivalent to pushing the follow checkbox button (but from your editor)
  • rebl-submit-form (for sending a form direct to REBL skipping your editor's REPL).

@jaidetree
Copy link
Author

jaidetree commented Dec 13, 2018

I have no objections to those but I think it can be helpful to think them through as user stories:

As a user familiar with REBL I want to create a keybinding to open the REBL UI so that I can quickly inspect eval results whenever I need it.

  • Sends nrebl-start-ui op to middleware.

As a beginner REBL user I expect it to automatically receive any forms sent to my REPL so I can quickly get familiar and use my pre-existing REPL process and keybindings.

  • Will help sell the experience seen in Stu's REBL demo video
  • Sends nrebl-toggle-follow to middleware
  • Active by default?

As an advanced REBL user I expect to be able to specify which forms I inspect in REBL as not all evaluations are valuable to inspect. I want to create a keybinding to select which forms should be inspected.

  • Sends nrebl-submit-form op to middleware
  • Question: Would the result of it be evaluated against the REPL environment at all or just inspect it as a value?

As a moderate REBL user I expect to be able to clear the REBL eval history after running it for a long time and having collected a lot of data that needs to be held in memory.

  • Sends nrebl-clear-history op to middleware
  • May need support from Cognitect if such a function does not exist.
  • Definitely helpful if follow mode is active

@RickMoynihan
Copy link
Owner

Yes thanks for that.

I agree that we probably also want an nrebl-clear-history, though I've not seen any such function exposed. Also this might be achievable simply by closing the REBL window, though there's no function hook to do that, that I'm aware of either.

Regarding nrebl-submit-form:

Would the result of it be evaluated against the REPL environment at all or just inspect it as a value?

I'd thought about this too and think we really need to do a read and eval as I think users will normally expect evaluating a form like (let [x 10] x) to return 10 not the s-expression. And an un evaluated form won't have any datafy metadata on it. If you have a form in your editor it'll normally be small enough to view in your editor anyway. Finally if you had evaluated a value and bound it to a var, then sent the var back to REBL it could easily contain unprintable values, and thus is unlikely to work as expected.

@RickMoynihan
Copy link
Owner

Also we should rename all the above to be prefixed with nrebl-, as they're really instructions for our middleware not rebl itself.

@jaidetree
Copy link
Author

jaidetree commented Dec 13, 2018

That sounds good to me. We may not be able to provide nrebl-clear-history without support but Is there a way to fake it by creating a function that closes and reopens rebl?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants