nep1: prefer self to this by timotheecour · Pull Request #16927 · nim-lang/Nim (original) (raw)

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation3 Commits1 Checks0 Files changed

Conversation

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters

[ Show hidden characters]({{ revealButtonHref }})

@timotheecour

settles Anybody using self or this for procedures operating on "class" style object types? - Nim forum

rationale

proc fun(someLongTypeName: SomeLongTypeName, a: int)

crude stats because some references might correspond to this as a param name, but still illustrative:

rg '\bthis\b' | wc -l
    3580
rg '\bself\b' | wc -l
     764

future work

@timotheecour

@juancarlospaco

Another PR to replace all remaining this with self.

We should also remove {.this: self.} to be consistent, been several years Deprecated already.

@timotheecour

Another PR to replace all remaining this with self.
We should also remove {.this: self.} to be consistent, been several years Deprecated already.

ok to both but in another PR (note that renaming 1st param from this to self is a potential breaking change in case user writes foo(this = bar, ...), but this is unlikely in practice; anyways, this can be discussed in another PR)

@dom96

ardek66 pushed a commit to ardek66/Nim that referenced this pull request

Mar 26, 2021

@timotheecour @ardek66