Skip to end of metadata
Go to start of metadata

Using the Boo.Lang.Interpreter API is quite straightforward. You can expose values to the scripting environment through the SetValue call and you can read values from the scripting environment with the GetValue call. The Eval call allows you to execute arbitraly complex source code:

You can also use InteractiveInterpreter as an expression evaluator by setting RememberLastValue:

A nice trick is to provide code completion in a GUI application by leveraging InteractiveInterpreter.SuggestCodeCompletion:

entity is a reference to the Boo.Lang.Compiler.TypeSystem.IEntity object found as the target of the codecomplete member.

Exposing code from an arbitrary assembly (let's say the current executing one) to the interactive interpreter instance is done through the References collection:

A more complete example of a script which callbacks to the precompiled code:

  • No labels