Skip to content

Make it impossible to forget to forward SourceChanges #54

@Lythenas

Description

@Lythenas

As a developer and user of the library I want to be able to call other functions in my (native) functions and not have to worry about manually combining and forwarding the source changes.

CallResult should take care of this. However this is not easy in C++.


There are mostly two possibilites:

  1. Create a global variable and automatically track the SourceChanges when one is generated
    • this makes it hard to ignore specific source changes manually
    • this is an ugly hack and might cause some problems down the line
    • also forces us to be completely single threaded
  2. Add methods to CallResult to make it easier to not forget to track a source change
    • This will still require the user to call these methods. It's not a guarantee that it won't be forgotten.
      CallResult result = 5;
      result.with(ctx.get("some_func").call(ctx, 22));
      return result; // contains source changes from some_func
    • One way to enforce at runtime that no CallResult is forgotten would be to use a clean flag and throw an exception in the destructor. But throwing exceptions in destructors is usually a bad idea.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-interpreterArea: InterpreterC-featureCategory: Feature (User Story)P-highPriority: High

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions