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

Document method-call expressions in pseudo-code as well as prose #1432

Closed

Conversation

madsmtm
Copy link
Contributor

@madsmtm madsmtm commented Dec 2, 2023

I personally find the documentation on method-call expressions very hard to grok, and I suspect I'm not the only one, so I thought I would attempt to rewrite the section in pseudo-code, to hopefully make the algorithm clearer.

This is done as a precursor to fixing #718 and #1018, which is important for RFC 3519 where we're trying to change the algorithm.


// Then, for each candidate `T`, add `&T` and `&mut T` to the list
// immediately after `T`.
let candidate_receiver_types = candidate_receiver_types.map(|T| [T, &T, &mut T]).flatten();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

flat_map? I know this is just pseudo-Rust!

@traviscross traviscross added the S-waiting-on-review Status: The marked PR is awaiting review from a maintainer label Jul 16, 2024
@traviscross
Copy link
Contributor

traviscross commented Jul 16, 2024

@rustbot labels -S-waiting-on-review +S-wating-on-author

We discussed this in the rustdocs call today. On review, we're just not happy with the pseudocode here. It feels like it takes more effort to understand the pseudocode than the value that it's providing.

Maybe another way to approach this would be more of an English pseudocode similar to what @ehuss wrote here:

It might also be interesting if this pseudocode could be made non-pseudo. In doing that, it would be similar in spirit to:

We're still working out how exactly to tie those things into the Reference/Specification. But this, expanded to be runnnable, would seem to fall in the same category.

@traviscross traviscross added S-waiting-on-author Status: The marked PR is awaiting some action (such as code changes) from the PR author. and removed S-waiting-on-review Status: The marked PR is awaiting review from a maintainer labels Jul 16, 2024
@madsmtm
Copy link
Contributor Author

madsmtm commented Jul 16, 2024

Yeah, that's fair, I wasn't really happy with it myself, which is why I hadn't pursued this further. Thanks for taking the time to review it, I might still try to fix the linked issues, but will do so in another PR in any case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: The marked PR is awaiting some action (such as code changes) from the PR author.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants