Boo
  1. Boo
  2. BOO-255

Allow outside scopes to be used by boo interpreter

    Details

    • Type: Improvement Improvement
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 0.7
    • Component/s: None
    • Labels:
      None
    • Number of attachments :
      0

      Description

      Make it easier to run the boo interpreter from a regular boo or C# script by letting the caller provide an outside object that is used for name resolution lookups (via system.reflection).

      Perhaps make an overload of interpreter.Eval that accepts an object to be used for name lookups if the regular lookups fail.

      Or maybe create an "AddScope(instance as object)" method so that multiple outside objects can be used for name lookups.

      Or else use events or virtual methods to let us hook into the boo interpreter:

      class LocalInterpreter(InteractiveInterpreter):
      instance
      mytype as Type
      def constructor(inst):
      instance = inst
      mytype = inst.GetType()
      override def Lookup(name as string): //not possible

      class Person
      ....
      def ToString():
      interpreter = LocalInterpreter(self)
      result = interpreter.Eval(formatstring)
      return result.ToString() if len(result.Errors) == 0

      I don't know the best solution.

        Activity

        Hide
        Rodrigo B. de Oliveira added a comment -

        A new class has been added to Boo.Lang.Interpreter:

        AbstractInterpreter

        The methods Lookup, Declare, GetValue and SetValue can be overriden for simple custom name processing.

        Show
        Rodrigo B. de Oliveira added a comment - A new class has been added to Boo.Lang.Interpreter: AbstractInterpreter The methods Lookup, Declare, GetValue and SetValue can be overriden for simple custom name processing.

          People

          • Assignee:
            Unassigned
            Reporter:
            Doug H
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: