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

update depreciated code #7502

Merged
merged 2 commits into from
Dec 23, 2020
Merged

update depreciated code #7502

merged 2 commits into from
Dec 23, 2020

Conversation

g-w1
Copy link
Contributor

@g-w1 g-w1 commented Dec 20, 2020

  • fix depreciated interface, update outStream -> writer
  • make code more readable by updating anytype -> std.fs.File.Writer

Was there a reason for anytype? A compiler bug?

* fix depreciated interface, update outStream -> writer
* make code more readable by updating `anytype` -> `std.fs.File.Writer`
@LemonBoy
Copy link
Contributor

LemonBoy commented Dec 20, 2020

Was there a reason for anytype? A compiler bug?

Duck typing. You want to accept any kind of reader, be it from a fs.File or some other io.reader.

@g-w1
Copy link
Contributor Author

g-w1 commented Dec 20, 2020

Ah, I had always heard to avoid anytype when possible. Should I switch it back?

@g-w1
Copy link
Contributor Author

g-w1 commented Dec 20, 2020

I am also going to fix outStream -> writer throughout the whole codebase. When doing this in merge_anal_dumps.zig, it was heavily bitrotted (didn't compile), so I am fixing that.

@g-w1 g-w1 changed the title make print_env more readable and update depreciated interface update depreciated code Dec 20, 2020
@andrewrk
Copy link
Member

You're being told simultaneously to avoid anytype when possible and that it's needed for I/I streams. This dissonance is a recognized design flaw: #764

I don't have a solution for it yet; this wart in the language has survived for quite some time now.

@g-w1
Copy link
Contributor Author

g-w1 commented Dec 20, 2020

Well for this, I think the only use is to print to stdout, so it is OK to have the type. Also when updating the depreciated interface, merge_anal_dumps.zig failed to compile. Is it even used anymore? It seems very bitrotted. I tried to fix it, but then realized that I shouldn't waste my time if its not used anymore.

@Vexu Vexu merged commit 51a9046 into ziglang:master Dec 23, 2020
aarvay pushed a commit to aarvay/zig that referenced this pull request Jan 4, 2021
* `zig env`:

* fix depreciated interface, update outStream -> writer
* make code more readable by updating `anytype` -> `std.fs.File.Writer`
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.

4 participants