Insights and limitations

The following events should normally happen after users type the :LEval command:

  1. On the first run, LitREPL starts the Python interpreter in the background. Its standard input and output are redirected into UNIX pipes in the current directory.
  2. LitREPL runs the whole document through the express Markdown/Latex parser determining the start/stop positions of code and result sections. The cursor position is also available and the code from the right code section can reach the interpreter.
  3. The process which reads the interpreter's response is forked out of the main LitREPL process. The output goes to the temporary file.
  4. If the interpreter reports the completion quickly, the output is pasted to the resulting document immediately. Otherwise, the temporary results are pasted.
  5. Re-evaluating sections with temporary results causes LitREPL to update these results.

Known Limitations:

  • Formatting: Nested code sections are not supported.
  • ~~Formatting: Special symbols in the Python output could invalidate the document~~.
  • Interpreter: Extra newline is required after Python function definitions.
  • Interpreter: Stdout and stderr are joined together.
  • ~~Interpreter: Evaluation of a code section locks the editor~~.
  • Interpreter: Tweaking os.ps1/os.ps2 prompts of the Python interpreter could break the session.
  • ~~Interpreter: No asynchronous code execution.~~
  • ~~Interpreter: Background Python interpreter couldn't be interrupted~~
  • ~~Bad PDF fonts in Firefox~~