Runtime evaluation: Difference between revisions

Content added Content deleted
m (Made result explicit)
(GP)
Line 630: Line 630:


By restricting the environment it is possible to restrict what kind of programs can be run.
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}}==
=={{header|Perl}}==