Runtime evaluation: Difference between revisions
Content added Content deleted
(New post showing the use of Java's REPL jshell. In addition to an existing post.) |
(→Insitux: inclusion) |
||
Line 690: | Line 690: | ||
READ(FIle="my_file.txt", Row=6) string |
READ(FIle="my_file.txt", Row=6) string |
||
XEQ( string ) ! executes row 6 of my_file.txt</syntaxhighlight> |
XEQ( string ) ! executes row 6 of my_file.txt</syntaxhighlight> |
||
=={{Header|Insitux}}== |
|||
All valid Insitux code can be evaluated at runtime using <code>eval</code>, including function definitions, with access to the same scope as the <code>eval</code> invocation including the comparatively ephemeral <code>let</code> variables. |
|||
<syntaxhighlight lang="insitux"> |
|||
(let x 123) |
|||
[ |
|||
(eval "(let y 100) (+ x y)") |
|||
y |
|||
] |
|||
</syntaxhighlight> |
|||
{{out}} |
|||
<pre> |
|||
[223 100] |
|||
</pre> |
|||
It's almost as if the original code was directly present, except error messages which are slightly different. |
|||
<b>Normal invocation error output:</b> |
|||
<pre> |
|||
1:6 (let time 1) |
|||
Parse Error: "time" cannot be redefined: already exists. |
|||
</pre> |
|||
<b><code>eval</code> invocation error output:</b> |
|||
<pre> |
|||
1:2 (eval "(let time 1)") |
|||
Eval Error: error within evaluated code. |
|||
Parse Error: 1695133413649 eval line 1 col 6: "time" cannot be redefined: already exists |
|||
</pre> |
|||
=={{header|J}}== |
=={{header|J}}== |