Deprecate TaintedString (#15423)
Co-authored-by: Timothee Cour <timothee.cour2@gmail.com> Co-authored-by: Dominik Picheta <dominikpicheta@googlemail.com>
This commit is contained in:
parent
7b632f9ccb
commit
78a99587a4
36 changed files with 184 additions and 229 deletions
|
|
@ -1718,28 +1718,6 @@ e.g. with given example ``echo("ab")`` will be rewritten just once:
|
|||
``noRewrite`` pragma can be useful to control term-rewriting macros recursion.
|
||||
|
||||
|
||||
Taint mode
|
||||
==========
|
||||
|
||||
The Nim compiler and most parts of the standard library support
|
||||
a taint mode. 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:: nim
|
||||
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``.
|
||||
|
||||
|
||||
Aliasing restrictions in parameter passing
|
||||
==========================================
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue