Skip to content

Handle undo for xeus-cpp/xeus-cpp-lite #263

@anutosh491

Description

@anutosh491

Clang-repl provides an undo option which I guess should help us get past redefinition issues .
https://llvm.org/devmtg/2022-11/slides/Lightning6-RecoveringFromErrorsInClang-ReplAndCodeUndo.pdf

For example

anutosh491@Anutoshs-MacBook-Air bin % ./clang-repl
clang-repl> extern "C" int printf(const char*, ...);
clang-repl> int x = 50;
clang-repl> %undo
clang-repl> const char* x = "Hello World";
clang-repl> auto r = printf("%s\n", x);
Hello World

Without the undo you would get

clang-repl> int y = 50;
clang-repl> const char* y = "Hello World";
In file included from <<< inputs >>>:1:
input_line_6:1:13: error: redefinition of 'y' with a different type: 'const char *' vs 'int'
    1 | const char* y = "Hello World";
      |             ^
input_line_5:1:5: note: previous definition is here
    1 | int y = 50;
      |     ^
error: Parsing failed.

When the same is attempted through xeus-cpp, it is being considered as a magic but probably should be looked at from a simple execute_request point of view .

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingenhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions