Skip to content

Linewise evaluation with async queue #1017

@lionel-

Description

@lionel-

This might be an alternative to tagged prompts (#1008) that is potentially more robust with a better console output.

The idea is to send inputs linewise to R, and wait for output with a very short delay. If we see a trailing prompt (continuation or otherwise) after that delay, send the next line immediately. Otherwise, this means the expression was complete and R is busy computing it. We save the rest of inputs in an accumulation buffer. When we receive new output in the filter, we check for a trailing prompt (continuation or otherwise) and send the next accumulated line if any. If the user sends new inputs but R is busy, this goes in the accumulation buffer. If the user sends an interrupt, we cancel all pending inputs.

This should result in interlaced inputs and outputs like when ess-eval-visibly it t but without the freezes. Actually we might even deprecate this option and only support linewise evaluation.

Could this work? The only issue I can think of is that if an output batch artificially contains a trailing prompt, we'll send the next line even though R is still busy. This will mess up the interlacing of inputs and outputs but shouldn't otherwise have deleterious effects. Also, I can't imagine this will be a common edge case.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions