sockets.recv optimizations; stdlib now supports taint mode

This commit is contained in:
Araq 2011-09-24 20:22:53 +02:00
commit 0f37d0e1f2
14 changed files with 112 additions and 74 deletions

View file

@ -3402,3 +3402,25 @@ The interaction between threads and exceptions is simple: A *handled* exception
in one thread cannot affect any other thread. However, an *unhandled*
exception in one thread terminates the whole *process*!
Taint mode
==========
The Nimrod compiler and standard library support a `taint mode`:idx:.
Input strings are declared with the `TaintedString`:idx: string type declared
in the ``system`` module.
If the taint mode is turned on (via the ``--taintMode:on`` command line
option) it is a distinct string type which helps to detect input
validation errors:
.. code-block:: nimrod
echo "your name: "
var name: TaintedString = stdin.readline
# it is safe here to output the name without any input validation, so
# we simply convert `name` to string to make the compiler happy:
echo "hi, ", name.string
If the taint mode is turned off, ``TaintedString`` is simply an alias for
``string``.