Skip to content

stdlib_experimental_io: addition of a spec and extension of loadtxt and savetxt to support integers #120

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

Merged
merged 3 commits into from
Jan 25, 2020

Conversation

jvdp1
Copy link
Member

@jvdp1 jvdp1 commented Jan 22, 2020

  • Addition of a spec (stdlib_experimental_io.md) for the procedures in stdlib_experimental_io.f90 (loadtxt, savetxt, and open). This spec is different than previously because it also describes subroutines.
  • Extension of loadtxt and savetxt to support integer.
  • The file stdlib_experimental_io.f90 was generated from the file stdlib_experimental_io.fypp using fypp.

@jvdp1 jvdp1 requested review from certik and milancurcic January 22, 2020 17:10
Copy link
Member

@certik certik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is excellent! Thank you for doing it. I don't have any objections, this seems like a strict improvement.

Comment on lines 60 to 66
| `r` | open for reading (default) |
| `w` | open for writing, truncating the file first |
| `x` | open for exclusive creation, failing if the file already exists |
| `a` | open for writing, appending to the end of the file if it exists |
| `b` | binary mode |
| `t` | text mode (default) |
| `+` | open for updating (reading and writing) |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe an extra sentence would be helpful to indicate which of these can be used together? I had to look at the code, to know I can select one letter r, w, x, a; one from b,t; and optionally the +. But perhaps this is not yet so critical as long as we are in the experimental stage.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you. I think it is important that we get a correct spec at this stage already. Otherwise it will lead to other PRs.

Would the following sentence be enough:

mode may include one character to define which mode you want to open the file in (i.e., r, w, x, and a) and one character to specify if the file should be handled as a binary or a text file (i.e., b, or t). mode may optionally include a third character + to open the file for updating. The default mode is rt (i.e. open for reading a text file).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will reply later, however before I forget I think the characters in the table should be enclosed with quotation marks (single or double?) so they get rendered in Markdown as a character literals?
| r | open for reading (default) |
| 'r' | open for reading (default) | <-- like this

The same follow for the modes mentioned in the text, e.g. The default mode is 'rt'.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ivan-pi I modified the spec following your comments. Please let me know if it is now clear.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quotes should be inside the inline code block, not outside. So, 'r', not 'r' as it is now.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quotes should be inside the inline code block, not outside. So, 'r', not 'r' as it is now.

Good. And modified.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Compared to the Python documentation (e.g. open), the current explanation is relatively short and does not cover precisely what are the meanings of binary and text format and how they interact with the platform.

But I do not want to hinder progress, so good to go from my side too. 👍

Copy link
Member

@milancurcic milancurcic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fantastic, thank you @jvdp1. Good to go in my opinion, pending any edits suggested by others.

@jvdp1 jvdp1 merged commit 4473a8c into fortran-lang:master Jan 25, 2020
@jvdp1 jvdp1 deleted the io_dev branch January 25, 2020 14:07
@certik
Copy link
Member

certik commented Jan 25, 2020 via email

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