Jump to content

Runtime evaluation: Difference between revisions

GP
m (Made result explicit)
(GP)
Line 630:
 
By restricting the environment it is possible to restrict what kind of programs can be run.
 
=={{header|PARI/GP}}==
Since GP is usually run from the [[wp:Read–eval–print loop|REPL]] gp, it is trivial to evaluate programs at runtime (most are run this way). Slightly less trivial is passing code around as a first-class object:
 
<lang parigp>runme(f)={
f()
};
 
runme( ()->print("Hello world!") )</lang>
 
One facility designed for restricting such embedded programs is <code>default(secure,1)</code> which denies scripts the ability to run <code>system</code> and <code>extern</code>. This cannot be turned off except interactively.
 
=={{header|Perl}}==
Cookies help us deliver our services. By using our services, you agree to our use of cookies.