Scheme.eval() get component by their name

private ProcedureN lookupProcedureInRepl(String procedureName) {
    Scheme lang = Scheme.getInstance();
    try {
      // Since we're in the REPL, we can cheat and invoke the Scheme interpreter to get the method.
      Object result = lang.eval("(begin (require <>)(get-var p$" +
          procedureName + "))");

the above code helps to get a procedure in ReplForm in the companion, similary what code should be given so that it will return a corresponding component by it's name ?

I believe that you're referencing my code here. Components are referenced solely by name, i.e., there is no decoration/mangling, so it should be sufficient to reference Button1 in this context rather than, say, p$procedureName. In particular, you can see this in runtime.scm:97 where we add the component name to the form's environment.

1 Like