Runtime evaluation: Difference between revisions

(added Liberty BASIC)
Line 789:
=={{header|Smalltalk}}==
<lang smalltalk>[ 4 + 5 ] value.</lang>
Evaluating aan blockexpression givenwithout as a stringbindings: (Squeak, Pharo)
<lang smalltalk>e := ' 123 degreesToRadians sin '.
Transcript show: (Compiler evaluate: e) .</lang>
To get local bindings (x, y),
evaluate an expression which yields a block given as a string, then call the resulting block:
<lang smalltalk>e := '[ :x :y | (x*x + (y*y)) sqrt ]'.
Transcript show: ((Compiler evaluate: e) value: 3 value: 4).</lang>
this could be wrapped into a utility, which expects the names to bind as argument, if required.
 
=={{header|SNOBOL4}}==
Anonymous user