Safe mode: Difference between revisions

Content added Content deleted
m (syntax highlighting fixup automation)
(Created Nim answer.)
Line 116: Line 116:


<syntaxhighlight lang="javascript">var interp1 = new Interp({isSafe:true, safeWriteDirs:['/tmp'], , safeReadDirs:['/tmp']});</syntaxhighlight>
<syntaxhighlight lang="javascript">var interp1 = new Interp({isSafe:true, safeWriteDirs:['/tmp'], , safeReadDirs:['/tmp']});</syntaxhighlight>

=={{header|Nim}}==
Nim doesn’t provide safe mode, but it make a distinction between safe and unsafe features. Safe features are those
which cannot corrupt memory integrity while unsafe ones can.

There is currently no restrictions for using unsafe features, but a programmer should be aware that they must be
used with care.

Here are some unsafe features:

* The ones dealing with raw memory and especially those using pointers. Note that Nim makes a
difference between pointers which allow access to raw (untraced) memory and references which allow access to
traced memory.

* Type casting which, contrary to type conversion, is a simple assignment of a new type without any
conversion to make the value fully compatible with the new type.

* Using <code>cstring</code> variables as no index checking is performed when accessing an element.

* Inserting assembly instructions with the <code>asm</code> statement.


=={{header|Perl}}==
=={{header|Perl}}==