.experimental can now be used to enable specific features

This commit is contained in:
Andreas Rumpf
2018-04-24 09:34:20 +02:00
parent 8ce9e43434
commit ee366f1746
18 changed files with 122 additions and 116 deletions

View File

@@ -35,7 +35,7 @@ Advanced options:
--noLinking compile Nim and generated files but do not link
--noMain do not generate a main procedure
--genScript generate a compile script (in the 'nimcache'
subdirectory named 'compile_$project$scriptext')
subdirectory named 'compile_$$project$$scriptext')
--genDeps generate a '.deps' file containing the dependencies
--os:SYMBOL set the target operating system (cross-compilation)
--cpu:SYMBOL set the target processor (cross-compilation)
@@ -88,5 +88,6 @@ Advanced options:
--parallelBuild:0|1|... perform a parallel build
value = number of processors (0 for auto-detect)
--verbosity:0|1|2|3 set Nim's verbosity level (1 is default)
--experimental enable experimental language features
--experimental:$1
enable experimental language feature
-v, --version show detailed version information

View File

@@ -1397,10 +1397,10 @@ dereferencing operations for reference types:
Automatic dereferencing is also performed for the first argument of a routine
call. But currently this feature has to be only enabled
via ``{.experimental.}``:
via ``{.experimental: "implicitDeref".}``:
.. code-block:: nim
{.experimental.}
{.experimental: "implicitDeref".}
proc depth(x: NodeObj): int = ...
@@ -5588,7 +5588,7 @@ dot operators
-------------
**Note**: Dot operators are still experimental and so need to be enabled
via ``{.experimental.}``.
via ``{.experimental: "dotOperators".}``.
Nim offers a special family of dot operators that can be used to
intercept and rewrite proc call and field access attempts, referring
@@ -6885,17 +6885,12 @@ is uncertain (it may be removed any time).
Example:
.. code-block:: nim
{.experimental.}
type
FooId = distinct int
BarId = distinct int
using
foo: FooId
bar: BarId
{.experimental: "parallel".}
proc useUsing(bar, foo) =
echo "bar is of type BarId"
echo "foo is of type FooId"
parallel:
for i in 0..4:
echo "echo in parallel"
Implementation Specific Pragmas
@@ -7917,7 +7912,7 @@ Example:
# Compute PI in an inefficient way
import strutils, math, threadpool
{.experimental.}
{.experimental: "parallel".}
proc term(k: float): float = 4 * math.pow(-1, k) / (2*k + 1)