Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rename
me
->self
#1382Rename
me
->self
#1382Changes from 20 commits
1313f57
e4911fe
5be6b1d
376c381
095e22e
04f3727
5e54440
26246f1
750850b
0c2ebf1
0aa81ec
00b2ffb
70ab609
5e8a646
2d077b1
ca8a8b5
b3a839b
13d3aef
57cd781
ca95431
fda1ceb
2b7ee5a
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this rationale should be expanded because of the break in consistency with C++. Yes, it won't always be the same type: but most C++ developers are familiar with the basic meaning of
this
, and the type would be in the function signature.For example, although you don't note the rationale here, I think you'd noted that
self
operates this way in Rust. However, that's Rust, and most C++ developers shouldn't be expected to be familiar with it. The surrounding syntax also differs from Rust, which I would expect to hamper experienced Rust devs.As a counterpoint to the Rust type argument, more likely C++ developers would be familiar with
self
in Python, due to its popularity, and it's always the same type there. From what I can tell, Swift is similar. Thus I don't seeself
as offering better cross-language consistency from a type perspective, since Rust is in a minority.I believe more information should be provided for the leads here -- it may even be appropriate to raise the question for explicit resolution, although it's perhaps redundant with this proposal.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the 'cons' colums, from a semantic standpoint, it feels less clear that
this
refers to the current instance.self
feels like it is less ambiguously refer 'itself' vs designating something with 'this'/'that'.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could expand this alternative to also suggest relying on user feedback on whether
this
not being a pointer would actually be surprising, rather than assumption.This applies to pretty much all syntax changes from C++, but: could mention the language strangeness budget i.e. the balancing of seemingly small syntax changes like this versus the more major changes we're planning to make.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One other point that may be worth capturing here is that we view it as an advantage to use the same spelling for the variable
self
as for the typeSelf
, and whilethis
might make an acceptable name for the object parameter,Self
is much more strongly established as the name for the current class, for example in PL research, and there is no precedent for a type namedThis
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've expanded in this update: fda1ceb
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(research is already done in the proposal)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added that link to history in the background section: see 2b7ee5a