Runtime evaluation: Difference between revisions
Content added Content deleted
(Added Java implementation) |
m (→{{header|Java}}: Added comment) |
||
Line 695: | Line 695: | ||
} |
} |
||
}.loadClass(className); |
}.loadClass(className); |
||
// Invoke a method on the thing we compiled |
|||
clarse.getMethod(methodName).invoke(clarse.newInstance()); |
clarse.getMethod(methodName).invoke(clarse.newInstance()); |
||
}catch(ClassNotFoundException | InstantiationException | IllegalAccessException | NoSuchMethodException | InvocationTargetException x){ |
}catch(ClassNotFoundException | InstantiationException | IllegalAccessException | NoSuchMethodException | InvocationTargetException x){ |
||
throw new RuntimeException("Run failed: " + x, x); |
throw new RuntimeException("Run failed: " + x, x); |
||
Line 707: | Line 710: | ||
at Evaluator.eval(Evaluator.java:33) |
at Evaluator.eval(Evaluator.java:33) |
||
at Evaluator.main(Evaluator.java:21)</pre> |
at Evaluator.main(Evaluator.java:21)</pre> |
||
=={{header|Lasso}}== |
=={{header|Lasso}}== |
||
"Sourcefile" when executed has access to all variables and other data that would be available in scope to an included file. |
"Sourcefile" when executed has access to all variables and other data that would be available in scope to an included file. |