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

RFC 56: Make buffered.reader.line return String iso^ #2756

Merged
merged 1 commit into from
Jun 7, 2018
Merged

Conversation

mfelsche
Copy link
Contributor

@mfelsche mfelsche commented Jun 6, 2018

This implements RFC 56 and fixes #2755

This is a breaking change for code bases that do not use explicit types when assigning the returned String iso^ to a variable:

let line = reader.line()?

These code bases need to either add an explicit type to their variable (let line: String val = reader.line()?) or need to consume the line upon aliasing or giving away to another function/behaviour.

@mfelsche mfelsche added the changelog - changed Automatically add "Changed" CHANGELOG entry on merge label Jun 6, 2018
@SeanTAllen
Copy link
Member

@mfelsche is this a breaking change? Given that folks have to consume. It seems like it is. In which case I'd like to wait til after 0.22.6 is released to merge. Putting "DO NOT MERGE" label for now.

@SeanTAllen SeanTAllen added do not merge This PR should not be merged at this time and removed do not merge This PR should not be merged at this time labels Jun 6, 2018
@SeanTAllen SeanTAllen merged commit 2671ed8 into master Jun 7, 2018
@SeanTAllen SeanTAllen deleted the rfc-56 branch June 7, 2018 14:36
ponylang-main added a commit that referenced this pull request Jun 7, 2018
@mfelsche
Copy link
Contributor Author

mfelsche commented Jun 7, 2018

Release notes draft:

buffered.Reader.line() has been changed to return a String iso^ instead of a String val. This is more powerful as it allows you to mutate the lines returned in place, which was impossible with String val. Nonetheless this is a breaking change. It will break code that relies on type inference, avoiding stating the type for the variable the line is assigned to:

let line = reader.line()?
process_line(line)

These code bases need to adapt in one of two ways:

  • mark the line variable explicitly as String val:

    let line: String val = reader.line()?
    process_line(line)
  • consume the variable upon usage, as it is iso now:

    let line = reader.line()?
    process_line(consume line)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog - changed Automatically add "Changed" CHANGELOG entry on merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RFC 56: Change buffered.Reader.line to return String iso^
2 participants