fix manual entry for .this pragma [ci skip]
This commit is contained in:
parent
e2f32deba3
commit
696dc1609f
1 changed files with 2 additions and 5 deletions
|
|
@ -2383,7 +2383,8 @@ Automatic self insertions
|
||||||
Starting with version 0.14 of the language, Nim supports ``field`` as a
|
Starting with version 0.14 of the language, Nim supports ``field`` as a
|
||||||
shortcut for ``self.field`` comparable to the `this`:idx: keyword in Java
|
shortcut for ``self.field`` comparable to the `this`:idx: keyword in Java
|
||||||
or C++. This feature has to be explicitly enabled via a ``{.this: self.}``
|
or C++. This feature has to be explicitly enabled via a ``{.this: self.}``
|
||||||
statement pragma. This pragma is active for the rest of the module:
|
statement pragma (instead of ``self`` any other identifier can be used too).
|
||||||
|
This pragma is active for the rest of the module:
|
||||||
|
|
||||||
.. code-block:: nim
|
.. code-block:: nim
|
||||||
type
|
type
|
||||||
|
|
@ -2398,10 +2399,6 @@ statement pragma. This pragma is active for the rest of the module:
|
||||||
# is rewritten to:
|
# is rewritten to:
|
||||||
# result = self.parentField + self.childField
|
# result = self.parentField + self.childField
|
||||||
|
|
||||||
Instead of ``self`` any other identifier can be used too, but
|
|
||||||
``{.this: self.}`` will become the default directive for the whole language
|
|
||||||
eventually.
|
|
||||||
|
|
||||||
In addition to fields, routine applications are also rewritten, but only
|
In addition to fields, routine applications are also rewritten, but only
|
||||||
if no other interpretation of the call is possible:
|
if no other interpretation of the call is possible:
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue