-
Notifications
You must be signed in to change notification settings - Fork 10
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
Fix std/random bug (#204) #211
Conversation
- Remove OpenSystemsLab/tempfile.nim and replace with build-in `std/tempfiles` - Remove low level stuff that might break in newer Windows update and replace with build-in `fusion/ioutils` - Add ability to name the temp file
I am going to investigate the error for the time begin |
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.
First off, congratulations and thanks for opening your first PR to nimib 🥳 Your contribution is very appreciated!
I have requested a few changes (one which maybe could solve the CI error). In addition to that you will also have to add fusion
as a dependency in the nimib.nimble
file.
I am going to investigate the error for the time begin
Temporary close
No need to close this IMO, there's no rush, leave it open and fix it when you have time :D
Isn't fusion already part of semi standard library that already come compiler? Like experimental features Edit: Oh https://forum.nim-lang.org/t/7608 |
Yeah, |
All the tests are passing now, so we have solved part of the issue 🥳 Now we have a new error though, |
I have no idea ._., might need to check with |
Yeah, I'll investigate it. Sweet dream 😴 |
I have managed to reduce it to a minimal example, and it's a compiler problem template foo(x: string, body: untyped) =
echo x
body
template foo(body) =
foo("Goodbye", body)
foo("Hello"): # works
proc f() = discard
echo "World"
foo: # doesn't work
proc f() = discard
echo "World" The problem is that we have an overload of I will open an issue on Nim's issue tracker, but the workaround for us would be to don't have two overloads and instead just keep one of them (with or without filename). |
It seems like this has been discussed here: nim-lang/RFCs#402 And it basically won't be fixed... So we have to do a workaround, and my vote is on removing the |
Also, you will need to merge our |
Great work @sent44, very well done and thanks! And excellent analysis by @HugoGranstrom of this weird issue. I would agree we can skip the version with filename. |
Looks good to me and the CI now. Thanks again for contributing to nimib 😁 I'll merge this in a moment |
note that this also closes the older issue of #72. And reading that makes me realise that this fix "breaks" nimib for nim < 1.6. Which is fine, I think. An option would have been to keep older code under |
Oh, had totally missed that :O But I agree, 1.4.x is old by now. I think we should keep 1.6.x working as long as possible though as 2.0 brings some breaking changes that could break people's old articles using old versions of libraries.
Correct, next release is 3.10. These two commits are not included in the latest release either:1 2 |
std/tempfiles
Without
randomize()
that can be found in that package, the random result in user code will be consistentfusion/ioutils
As it might break in newer Windows update
reuse the same file every time
I don't know if this statement mean that you can give name the temp file and if it is already exist then open or temp file name is generate and you can use old file in some way, so I implement the first one. Should not break exist code (Didn't test against the main package)This should not need to modify docs as it is internal stuff hide be hide
nbCode
fixed #204
Test
Expect result