Skip to content

Add the parse of access in mode of the open function, to close #465. #519

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

Closed
wants to merge 1 commit into from
Closed

Conversation

zoziha
Copy link
Contributor

@zoziha zoziha commented Sep 10, 2021

select case (mode_(4:4))
    case('u'); access_ = 'sequential'  !! u: universal
    case('d'); access_ = 'direct'
    case('s'); access_ = 'stream'
end select
  • add sequential and direct access support in the open function.

Description

To fix #465 , I think open as a more basic function, there are three types of access (sequential, direct, stream) are supported in the fortran syntax, so keeping stream as the default and adding support for sequential and direct is currently acceptable.

@milancurcic
Copy link
Member

Thanks @zoziha. Though potentially useful (other than for fixing the logger), I'm not convinced that these are necessary.

A downside is that it complicates the API--we're now adding the 4th (Fortran-specific) letter to the syntax. It's a development and maintenance cost for us, and a learning cost for the user.

The upside is that it'd now work with the stdlib logger, and users who want to use sequential or direct access with stdlib_io open, now can.

I wonder if we should deprecate sequential and direct access from the stdlib_io POV. Is there anything that we can do with sequential or direct access that we can't do with stream access? If yes, the solution to #465 would be to update the logger to use stream access.

@certik
Copy link
Member

certik commented Sep 15, 2021

My feeling is similar to @milancurcic in that the beauty of the open function is that it behaves similarly to Python or C and it simplifies the usage. The letters / API that it allows are cross platform, there is nothing Fortran or C or Python specific in it and most people quickly understand the usage. This PR adds some Fortran specific usage, and to be honest I myself would not be able to explain the difference between "u", "d" and "s", without studying. It seems it's not worth doing --- if a specific application demands this level of control, then using the intrinsic open statement seems like the way to go.

@zoziha
Copy link
Contributor Author

zoziha commented Sep 15, 2021

Okay, I think what you said is correct and reasonable. It seems that we should try to modify the sequential requirements in stdlib_logger to stream. (see #465 )

@jvdp1
Copy link
Member

jvdp1 commented Sep 15, 2021

FWIW I agree with @milancurcic and @certik regarding the additional letters in open().

I think we discussed with @wclodius2 the differences between sequential vs stream for stdlib_logger when he developed it. But I can't find back this discussion. So I may be wrong. I highly suggest to discuss this "issue" with @wclodius2 before opening a PR.

@wclodius2
Copy link
Contributor

I am on travel again. Travel and catching up on activities delayed by travel, makes it hard to code and document the code. Right now my coding is focussed on hash functions and hash tables. I had thought I was caught up with the coding for hashes, but SMHasher added some more tests (particularly for bad seeds), that showed problems with some of the hash codes I had adapted, and added some hash codes that were better than what I was using, so I have been redoing my hash codes. When I get these into stdlib I will be willing to go back and redo some earlier codes.

@jvdp1
Copy link
Member

jvdp1 commented Sep 16, 2021

I am on travel again. Travel and catching up on activities delayed by travel, makes it hard to code and document the code. Right now my coding is focussed on hash functions and hash tables. I had thought I was caught up with the coding for hashes, but SMHasher added some more tests (particularly for bad seeds), that showed problems with some of the hash codes I had adapted, and added some hash codes that were better than what I was using, so I have been redoing my hash codes. When I get these into stdlib I will be willing to go back and redo some earlier codes.

@wclodius2 Nice that you are working on the hash codes. If you need some help, don't hesitate to ask for it.
Re: stdlib_logger, we will first see what will result from the future discussion ;)

@zoziha
Copy link
Contributor Author

zoziha commented Sep 17, 2021

Thank you for your comments. It seems that this PR is unnecessary, and I will cancel this PR.

@zoziha zoziha closed this Sep 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants