Runtime evaluation: Difference between revisions

→‎{{header|Lasso}}: Adding Lasso explanation and example
(GP)
(→‎{{header|Lasso}}: Adding Lasso explanation and example)
Line 464:
 
J relies on the OS for sandboxing and does not offer any additional resource constraints.
 
 
=={{header|Lasso}}==
"Sourcefile" when executed has access to all variables and other data that would be available in scope to an included file.
 
This means thread vars ($) and types/methods already defined will be accessible.
 
Types, methods, traits and thread vars created or modified will maintain state subsequently -
i.e.
if a type is defined in code executed in a sourcefile context then that type will be available after execution.
if a thread var is modified in the sourcefile executed code then the var will maintain that value after execution.
 
Local variables (#) maintain scope behaviour as normal.
 
Output is governed by the "autocollect" boolean, the third parameter in the sourcefile invocation.
 
<lang Lasso>//code, fragment name, autocollect, inplaintext
local(mycode = "'Hello world, it is '+date")
sourcefile('['+#mycode+']','arbritraty_name', true, true)->invoke
 
'\r'
 
 
var(x = 100)
local(mycode = "Outside Lasso\r['Hello world, var x is '+var(x)]")
// autocollect (3rd param): return any output generated
// inplaintext (4th param): if true, assumes this is mixed Lasso and plain text,
// requires Lasso code to be in square brackets or other supported code block demarkation.
sourcefile(#mycode,'arbritraty_name', true, true)->invoke
 
'\r'
 
var(y = 2)
local(mycode = "'Hello world, is there output?\r'
var(x) *= var(y)")
// autocollect (3rd param): as false, no output returned
// inplaintext (4th param): as false, assumes this is Lasso code, no mixed-mode Lasso and text.
sourcefile(#mycode,'arbritraty_name', false, false)->invoke
'var x is now: '+$x
 
'\r'
 
var(z = 3)
local(mycode = "var(x) *= var(z)")
sourcefile(#mycode,'arbritraty_name', false, false)->invoke
'var x is now: '+$x</lang>
 
{{out}}
<pre>Hello world, it is 2013-11-10 15:54:19
Outside Lasso
Hello world, var x is 100
var x is now: 200
var x is now: 600</pre>
 
=={{header|Liberty BASIC}}==
140

edits