nep1: prefer self to this (#16927)
This commit is contained in:
parent
cccf219ceb
commit
534a95aee0
1 changed files with 7 additions and 4 deletions
11
doc/nep1.rst
11
doc/nep1.rst
|
|
@ -162,10 +162,13 @@ to keep the names short but meaningful.
|
||||||
------------------- ------------ --------------------------------------
|
------------------- ------------ --------------------------------------
|
||||||
English word To use Notes
|
English word To use Notes
|
||||||
------------------- ------------ --------------------------------------
|
------------------- ------------ --------------------------------------
|
||||||
initialize initT ``init`` is used to create a
|
initialize initFoo initializes a value type ``Foo``
|
||||||
value type ``T``
|
new newFoo initializes a reference type ``Foo``
|
||||||
new newP ``new`` is used to create a
|
via ``new``
|
||||||
reference type ``P``
|
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
|
find find should return the position where
|
||||||
something was found; for a bool result
|
something was found; for a bool result
|
||||||
use ``contains``
|
use ``contains``
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue