-
Notifications
You must be signed in to change notification settings - Fork 303
Post on language ergonomics initiative #149
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
Conversation
(rust_highfive has picked a reviewer for you, use r? to override) |
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.
left a few nits, love it
_posts/2017-03-02-lang-ergonomics.md
Outdated
vital. However: | ||
|
||
- The vast majority of methods borrow `self`, rather than taking it by value. | ||
- Usually the name of a method makes obvious whether the `self` borrow will be |
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.
Nit: "makes it obvious"
_posts/2017-03-02-lang-ergonomics.md
Outdated
|
||
- The vast majority of methods borrow `self`, rather than taking it by value. | ||
- Usually the name of a method makes obvious whether the `self` borrow will be | ||
mutable or not (e.g. `push` versus `len`). |
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.
Nit: push()
, len()
_posts/2017-03-02-lang-ergonomics.md
Outdated
- Usually the name of a method makes obvious whether the `self` borrow will be | ||
mutable or not (e.g. `push` versus `len`). | ||
- The borrow checker will prevent any incorrect borrowing, though if borrowing | ||
were too implicit, it could make debugging borrow check errors harder. |
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.
Nit: "borrow-check errors"
``` | ||
|
||
But we could easily allow you to write `read_config(path)`, implicitly borrowing | ||
`path` for `read_config` and then *dropping it* immediately afterwards. 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.
I still feel like it might be helpful to say, effectively desugaring into something like:
let config = {
let tmp = path;
read_config(&tmp)
};
but perhaps the syntax is too fancy
No description provided.