Skip to content

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

Merged
merged 4 commits into from
Mar 3, 2017

Conversation

aturon
Copy link
Member

@aturon aturon commented Mar 3, 2017

No description provided.

@rust-highfive
Copy link

r? @alexcrichton

(rust_highfive has picked a reviewer for you, use r? to override)

@erickt
Copy link
Contributor

erickt commented Mar 3, 2017

Rendered

Copy link
Contributor

@nikomatsakis nikomatsakis left a 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

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
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: "makes it obvious"


- 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`).
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: push(), len()

- 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.
Copy link
Contributor

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
Copy link
Contributor

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

@aturon aturon merged commit c29ba63 into rust-lang:gh-pages Mar 3, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants