Open
Description
There are two common scenarios in which a client might want to edit print limits (a.k.a. modify REPL state):
- At init time, provided the client lets its user tweak certain aspects of the REPL connection.
- As a one-off operation, where the client only needs to modify the REPL state for one loop (eval/print).
In any of those circumstances, the client might want to edit just one, or several, state variables.
Current implementation's pain-points:
- one-off operations entail possible callback-hell on the client side, there are at least two annidated callbacks to be executed that need to carry results from the initial operation. Example
-> send command to edit print limits to MAX_VALUE
-> callback (carry the default print-limit values):
send some action (i.e. "request docstring for symbol") that expects long lines not to be elided
-> callback (carry the default print-limit values):
revert print limits to default.
- There is no way to edit just one state variable. If a client wants to only edit
*print-level*
, it has to call the:print-limits
action with all the other bindings. Furthermore, the client has no way to know what are those values the first time.
Proposal:
Improve api to handle REPL state variables by:
- Adding initial state to
:unrepl/hello
. - Replacing
:print-limits
action for a more flexible version of it that can change a subset of variables at a time. Maybe also rename it to something more generic, in case more variables are added in the future.
--
Also, an idea I would like to bounce here: what about adding a function that handles one-offs state modifications internally, something like:
{:some/session-action (binding [*print-limit* Long/MAX_VALUE]
(foo/bar :unrepl/param :a-param))}
This would mean improving (ensure-ns)
to recursively search for fully qualified 'function' symbols and requiring them, and to have another variable in the REPL's state that tracks reverting the binding.
--
If accepted, I could code the result of this conversation.
Metadata
Metadata
Assignees
Labels
No labels