disable sink inference, only enable it for the stdlib. Reason: better source code compatibility (#15105)

This commit is contained in:
Andreas Rumpf 2020-07-28 19:18:46 +02:00 • committed by GitHub
commit 86c9b78339
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 18 additions and 5 deletions

View file

@ -261,8 +261,14 @@ optimizations (and the current implementation does not).
Sink parameter inference
========================
The current implementation does a limited form of sink parameter
inference. The `.nosinks`:idx: pragma can be used to disable this inference
The current implementation can do a limited form of sink parameter
inference. But it has to be enabled via `--sinkInference:on`, either
on the command line or via a `push` pragma.
To enable it for a section of code, one can
use `{.push sinkInference: on.}`...`{.pop.}`.
The `.nosinks`:idx: pragma can be used to disable this inference
for a single routine:
.. code-block:: nim
@ -270,8 +276,6 @@ for a single routine:
proc addX(x: T; child: T) {.nosinks.} =
x.s.add child
To disable it for a section of code, one can
use `{.push sinkInference: off.}`...`{.pop.}`.
The details of the inference algorithm are currently undocumented.