Merge branch 'devel' into araq
This commit is contained in:
commit
39f0195ebf
334 changed files with 4636 additions and 2763 deletions
|
|
@ -132,7 +132,7 @@ translated into a C array of undetermined size:
|
|||
|
||||
.. code-block:: nim
|
||||
type
|
||||
ArrayPart{.unchecked.} = array[0..0, int]
|
||||
ArrayPart{.unchecked.} = array[0, int]
|
||||
MySeq = object
|
||||
len, cap: int
|
||||
data: ArrayPart
|
||||
|
|
@ -146,10 +146,6 @@ Produces roughly this C code:
|
|||
NI data[];
|
||||
} MySeq;
|
||||
|
||||
The bounds checking done at compile time is not disabled for now, so to access
|
||||
``s.data[C]`` (where ``C`` is a constant) the array's index needs to
|
||||
include ``C``.
|
||||
|
||||
The base type of the unchecked array may not contain any GC'ed memory but this
|
||||
is currently not checked.
|
||||
|
||||
|
|
|
|||
|
|
@ -130,7 +130,7 @@ Two identifiers are considered equal if the following algorithm returns true:
|
|||
.. code-block:: nim
|
||||
proc sameIdentifier(a, b: string): bool =
|
||||
a[0] == b[0] and
|
||||
a.replace(re"_|–", "").toLower == b.replace(re"_|–", "").toLower
|
||||
a.replace("_", "").toLower == b.replace("_", "").toLower
|
||||
|
||||
That means only the first letters are compared in a case sensitive manner. Other
|
||||
letters are compared case insensitively and underscores are ignored.
|
||||
|
|
|
|||
|
|
@ -248,12 +248,20 @@ calls can use the ``do`` keyword:
|
|||
.. code-block:: nim
|
||||
sort(cities) do (x,y: string) -> int:
|
||||
cmp(x.len, y.len)
|
||||
|
||||
# Less parenthesis using the method plus command syntax:
|
||||
cities = cities.map do (x:string) -> string:
|
||||
"City of " & x
|
||||
|
||||
# In macros, the do notation is often used for quasi-quoting
|
||||
macroResults.add quote do:
|
||||
if not `ex`:
|
||||
echo `info`, ": Check failed: ", `expString`
|
||||
|
||||
``do`` is written after the parentheses enclosing the regular proc params.
|
||||
The proc expression represented by the do block is appended to them.
|
||||
In calls using the command syntax, the do block will bind to the immediately
|
||||
preceeding expression, transforming it in a call.
|
||||
|
||||
``do`` with parentheses is an anonymous ``proc``; however a ``do`` without
|
||||
parentheses is just a block of code. The ``do`` notation can be used to
|
||||
|
|
@ -275,8 +283,8 @@ Nonoverloadable builtins
|
|||
The following builtin procs cannot be overloaded for reasons of implementation
|
||||
simplicity (they require specialized semantic checking)::
|
||||
|
||||
declared, defined, definedInScope, compiles, low, high, sizeOf,
|
||||
is, of, shallowCopy, getAst, astToStr, spawn, procCall
|
||||
declared, defined, definedInScope, compiles, sizeOf,
|
||||
is, shallowCopy, getAst, astToStr, spawn, procCall
|
||||
|
||||
Thus they act more like keywords than like ordinary identifiers; unlike a
|
||||
keyword however, a redefinition may `shadow`:idx: the definition in
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue