-
Notifications
You must be signed in to change notification settings - Fork 25
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
feat: add basic file I/O implementations #60
Conversation
For reviewers coming from the original PR (dafny-lang/dafny#3018) - the module/file structure in this PR is much simplified. Because we're no longer concerned with stuffing the internal file I/O implementations into existing runtime module names, we have the freedom to name the containing module in a way that works across all languages. So now including This also means that consumers of the API no longer need to rely on module abstraction - just including and importing |
Just checking that read from stdin and write to stdout will be possible with this PR |
This is not in scope for this PR. |
(CI is failing for unrelated reasons, but should pass once #61 is merged.) |
The tests are failing because somehow the Dafny being run doesn't know about
Maybe |
Yes I think that's right. We did not update the dafny version in libraries for a long time. |
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.
Nice work, and well polished. I really appreciate the commitment to writing the same documentation in four different language dialects. :)
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.
This looks very nice!
/// </summary> | ||
public static void INTERNAL_ReadBytesFromFile(ISequence<char> path, out bool isError, out ISequence<byte> bytesRead, | ||
out ISequence<char> errorMsg) { | ||
isError = true; |
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.
I like that you initialize it this way. Starting out assuming an error and not indicating success until you've explicitly observed it is a nice practice.
This PR adds basic file I/O facilities (read bytes from a file, write bytes to a file) to the for C#, Java, Javascript. Python support is nearly complete, but is blocked by what I believe is a missing external-module import in compiled code. Golang support is out of scope for now, since it's blocked by dafny-lang/dafny#2989 and dafny-lang/dafny#2045.
This PR was migrated from dafny-lang/dafny#3018 for further development.
Fixes #50.
TODO:
Fix Python support (currently unable to reference the newly defined(Python support to be added as a follow-up)DafnyLibrary
from another compiled module)By submitting this pull request, I confirm that my contribution is made under the terms of the MIT license.