What is a parent interpreter?

I was going through the documentation of cling in Doxygen and saw that you can create an interpreter with a parent, but I can’t find any more information about it. I assume the “child” interpreter can access some of the parent’s data, but what exactly? What’s the advantage over just copying the interpreter?

Thanks in advance

This can be used for connecting an Interpreter to a parent Interpreter's AST: it is able to use that parent AST without modifying it. A feature like this is useful for tab completion of “volatile” input - where we cannot know whether what’s on the prompt is there to stay, and we thus don’t want to modify the AST because of it; see ClingCodeCompleteConsumer. Other use cases include lookup; I’m sure you might find more!

Note that we don’t currently use this “in production” (because we don’t have proper tab completion); we know that several of the clang features we use for this (ASTImporter) are not yet implemented.

HTH, patches welcome!


This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.