diff options
author | Juan Carlos <juancarlospaco@gmail.com> | 2020-09-15 06:59:33 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-15 11:59:33 +0200 |
commit | 073bea66064afd72cd5e0ffc65569a1833dce385 (patch) | |
tree | d2993b1c8cceef399a71b73936c0a3ee8a576f01 | |
parent | c38487aa225674f67659c28ce171fd93e2231ad1 (diff) | |
download | Nim-073bea66064afd72cd5e0ffc65569a1833dce385.tar.gz |
Remove Deprecated {.this:self.} from Documentation so people dont use it anymore (#15328)
-rw-r--r-- | doc/manual_experimental.rst | 36 |
1 files changed, 0 insertions, 36 deletions
diff --git a/doc/manual_experimental.rst b/doc/manual_experimental.rst index ac8dedf11..a96c121a2 100644 --- a/doc/manual_experimental.rst +++ b/doc/manual_experimental.rst @@ -321,42 +321,6 @@ scope. Therefore, the following will *fail to compile:* a() -Automatic self insertions -========================= - -**Note**: The ``.this`` pragma is deprecated and should not be used anymore. - -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 -or C++. This feature has to be explicitly enabled via a ``{.this: self.}`` -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 - type - Parent = object of RootObj - parentField: int - Child = object of Parent - childField: int - - {.this: self.} - proc sumFields(self: Child): int = - result = parentField + childField - # is rewritten to: - # result = self.parentField + self.childField - -In addition to fields, routine applications are also rewritten, but only -if no other interpretation of the call is possible: - -.. code-block:: nim - proc test(self: Child) = - echo childField, " ", sumFields() - # is rewritten to: - echo self.childField, " ", sumFields(self) - # but NOT rewritten to: - echo self, self.childField, " ", sumFields(self) - - Named argument overloading ========================== |