Skip to content
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

Change "method" to "associated function" #69498

Merged
merged 2 commits into from
Mar 15, 2020
Merged

Conversation

mark-i-m
Copy link
Member

r? @matthewjasper

cc @Centril @eddyb #67742

I'm opening this mostly as a test to see what the diagnostic changes would be. It seems that this makes them somewhat more verbose, and I'm not sure it's worth it...

The relevant changes are the last two commits (it is rebased on top of #67742)

@eddyb
Copy link
Member

eddyb commented Feb 26, 2020

Can you open a PR to fix #60163 without changing diagnostics?
Then we can separately do the diagnostic changes.

@bjorn3
Copy link
Member

bjorn3 commented Feb 28, 2020

To me a method is a special kind of associated function which takes a self parameter.

@mark-i-m
Copy link
Member Author

mark-i-m commented Mar 3, 2020

@bjorn3 I agree, but the compiler doesn't currently make a distinction iiuc

@bjorn3
Copy link
Member

bjorn3 commented Mar 3, 2020

It would be nice if the error messages do make the distinction.

@mark-i-m
Copy link
Member Author

mark-i-m commented Mar 3, 2020

Rebased over #69674

@rustbot modify labels: -S-waiting-on-review +S-blocked

@rustbot rustbot added the S-blocked Status: Marked as blocked ❌ on something else such as an RFC or other implementation work. label Mar 3, 2020
@Centril
Copy link
Contributor

Centril commented Mar 3, 2020

It would be nice if the error messages do make the distinction.

I think error messages should only make the distinction where it actually matters. Otherwise, you have to scan for self in many places where it is semantically irrelevant whether self is there or not.

JohnTitor added a commit to JohnTitor/rust that referenced this pull request Mar 5, 2020
Centril added a commit to Centril/rust that referenced this pull request Mar 6, 2020
Centril added a commit to Centril/rust that referenced this pull request Mar 6, 2020
Centril added a commit to Centril/rust that referenced this pull request Mar 7, 2020
@bors
Copy link
Contributor

bors commented Mar 8, 2020

☔ The latest upstream changes (presumably #69822) made this pull request unmergeable. Please resolve the merge conflicts.

Centril added a commit to Centril/rust that referenced this pull request Mar 12, 2020
@mark-i-m
Copy link
Member Author

@rustbot modify labels: +S-waiting-on-review -S-blocked

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-blocked Status: Marked as blocked ❌ on something else such as an RFC or other implementation work. labels Mar 12, 2020
@matthewjasper
Copy link
Contributor

@bors r+
cc @rust-lang/wg-diagnostics

@bors
Copy link
Contributor

bors commented Mar 13, 2020

📌 Commit b6518f0 has been approved by matthewjasper

@bors bors removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Mar 13, 2020
@bors bors added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Mar 13, 2020
JohnTitor added a commit to JohnTitor/rust that referenced this pull request Mar 14, 2020
…sper

Change "method" to "associated function"

r? @matthewjasper

cc @Centril @eddyb rust-lang#67742

I'm opening this mostly as a test to see what the diagnostic changes would be. It seems that this makes them somewhat more verbose, and I'm not sure it's worth it...

The relevant changes are the last two commits (it is rebased on top of rust-lang#67742)
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request Mar 14, 2020
…sper

Change "method" to "associated function"

r? @matthewjasper

cc @Centril @eddyb rust-lang#67742

I'm opening this mostly as a test to see what the diagnostic changes would be. It seems that this makes them somewhat more verbose, and I'm not sure it's worth it...

The relevant changes are the last two commits (it is rebased on top of rust-lang#67742)
bors added a commit that referenced this pull request Mar 15, 2020
Rollup of 7 pull requests

Successful merges:

 - #69357 (Emit 1-based column numbers in debuginfo)
 - #69471 (Remove `sip::Hasher::short_write`.)
 - #69498 (Change "method" to "associated function")
 - #69967 (Remove a few `Rc`s from RegionInferenceCtxt)
 - #69987 (Add self to .mailmap)
 - #69991 (fix E0117 message out of sync)
 - #69993 (Add long error explanation for E0693)

Failed merges:

r? @ghost
bors added a commit that referenced this pull request Mar 15, 2020
Rollup of 7 pull requests

Successful merges:

 - #69357 (Emit 1-based column numbers in debuginfo)
 - #69471 (Remove `sip::Hasher::short_write`.)
 - #69498 (Change "method" to "associated function")
 - #69967 (Remove a few `Rc`s from RegionInferenceCtxt)
 - #69987 (Add self to .mailmap)
 - #69991 (fix E0117 message out of sync)
 - #69993 (Add long error explanation for E0693)

Failed merges:

r? @ghost
@bors bors merged commit f40272c into rust-lang:master Mar 15, 2020
@mark-i-m mark-i-m deleted the describe-it-2 branch March 15, 2020 16:16
@estebank
Copy link
Contributor

It would be nice if the error messages do make the distinction.

I think error messages should only make the distinction where it actually matters. Otherwise, you have to scan for self in many places where it is semantically irrelevant whether self is there or not.

I disagree, I think it makes it much easier to teach the concepts if we are consistent in calling associated functions with self parameters "methods". I've seen this confusion play out many times and it is our responsibility to reduce "induced" confusion.

@mark-i-m
Copy link
Member Author

I guess I've personally experienced the opposite... in this case, I always used to here "associated X" and not really know what it meant because e.g. associated fn where inconsistently referred to as methods, functions, or assoc functions. Picking one and sticking to it would be good.

On the other hand, I think the main point in favor of method is that it is the terminology used by most other languages (e.g. java, c++).

@Centril
Copy link
Contributor

Centril commented Mar 15, 2020

Java also has the concept of "static method", which is our notion of an associated method without self, so that adds more to the confusion. Meanwhile, Haskell calls any function in a type class "method".

Centril added a commit to Centril/rust that referenced this pull request Mar 23, 2020
Replace some desc logic in librustc_lint with article_and_desc

r? @eddyb @Centril @matthewjasper

Followup to rust-lang#69674

Blocked on rust-lang#69498
Centril added a commit to Centril/rust that referenced this pull request Mar 23, 2020
Replace some desc logic in librustc_lint with article_and_desc

r? @eddyb @Centril @matthewjasper

Followup to rust-lang#69674

Blocked on rust-lang#69498
Centril added a commit to Centril/rust that referenced this pull request Mar 23, 2020
Replace some desc logic in librustc_lint with article_and_desc

r? @eddyb @Centril @matthewjasper

Followup to rust-lang#69674

Blocked on rust-lang#69498
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants