mirror of
https://github.com/nim-lang/Nim.git
synced 2026-01-06 04:57:49 +00:00
nep1: prefer self to this (#16927)
This commit is contained in:
11
doc/nep1.rst
11
doc/nep1.rst
@@ -162,10 +162,13 @@ to keep the names short but meaningful.
|
||||
------------------- ------------ --------------------------------------
|
||||
English word To use Notes
|
||||
------------------- ------------ --------------------------------------
|
||||
initialize initT ``init`` is used to create a
|
||||
value type ``T``
|
||||
new newP ``new`` is used to create a
|
||||
reference type ``P``
|
||||
initialize initFoo initializes a value type ``Foo``
|
||||
new newFoo initializes a reference type ``Foo``
|
||||
via ``new``
|
||||
this or self self for method like procs, e.g.:
|
||||
`proc fun(self: Foo, a: int)`
|
||||
rationale: `self` is more unique in english
|
||||
than `this`, and `foo` would not be DRY.
|
||||
find find should return the position where
|
||||
something was found; for a bool result
|
||||
use ``contains``
|
||||
|
||||
Reference in New Issue
Block a user