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

Introduce IO.new(..., path:) and promote File#path to IO#path. #6867

Merged
merged 6 commits into from Dec 8, 2022

Conversation

ioquatix
Copy link
Member

@ioquatix ioquatix commented Dec 6, 2022

The current semantics for File#path are at best difficult to deal with.

  • Can raise an error.
  • Makes it difficult for things that mock IO, e.g. GZip wrappers have to conditionally detect and add #path.

I've chosen to make this behave more like an attribute in IO#path which should ultimately be compatible with existing code except it can no longer raise an exception in normal usage.

https://bugs.ruby-lang.org/issues/19036

@ioquatix ioquatix requested a review from nobu December 6, 2022 07:58
@headius
Copy link
Contributor

headius commented Dec 6, 2022

Looks good to me but shouldn't rb_file_path remain as an alias for rb_io_path?

@headius
Copy link
Contributor

headius commented Dec 8, 2022

Looks good to me but shouldn't rb_file_path remain as an alias for rb_io_path?

rb_file_path is not in any of the public header files, so it is not part of the public API and does not need to remain.

@ioquatix
Copy link
Member Author

ioquatix commented Dec 8, 2022

I'm going to merge this as is, but:

  • Should we introduce IO#path=?
  • Should we introduce IO#dup(..., path:)?

@ioquatix ioquatix merged commit 6fd5d2d into ruby:master Dec 8, 2022
@ioquatix ioquatix deleted the io-new-path branch December 8, 2022 05:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants