cling/docs/chapters/REPL.rst

29 lines
1.5 KiB
ReStructuredText
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

Cling is (also, but not only) REPL
-----------------------------------
A `read-eval-print-loop <https://en.wikipedia.org/wiki/Read%E2%80%93eval%E2%80%93print_loop>`_
(**REPL**) is an interactive programming environment that takes user inputs,
executes them, and returns the result to the user. In order to enable
interactivity in C++, Cling provides several extensions to the C++ language:
1. **Defining functions in the global scope:** Cling redefines expressions at a
global level. C++ provides limited support for this, Cling possesses the
necessary semantics to re-define code while the program is running,
minimizing the impedance mismatch between the **REPL** and the C++ codebase,
and allowing for a seamlessly interactive programing experience.
2. **Allows for implementation of commands** that provide information about the
current state of the environment. e.g., has an `Application Programming
Interface <https://en.wikipedia.org/wiki/API>`_ (**API**) to provide
information about the current state of the environment.
3. **Error recovery:** Cling has an efficient error recovery system which allows
it to handle the errors made by the user without restarting or having to redo
everything from the beginning.
4. **Tight feedback loop:** It provides feedback about the results of the
developers choices that is both accurate and fast.
5. **Facilitates debugging:** The programmer can inspect the printed result
before deciding what expression to provide for the next line of code.