Open zoziha opened 3 years ago
Maybe I think open
as a more basic function, can you consider leaving a loose possibility for access
in open
function? access
can be included by the mode
argument, and access=stream
can be used by default.
https://github.com/fortran-lang/stdlib/blob/d0f13b08e4778961cb6d9c93886a65764bc5762d/src/stdlib_io.fypp#L211
Thanks @zoziha for bringing this inconsistency up.
I believe that @jvdp1 as author of the stdlib_io
and reviewer of the logger module is the best person to comment on this issue.
Thank you for reporting this incompatibilit. Please see the PR #71 and its code that introduced open()
in stdlib. With this code, the access
was sequential
. In #71 there was already a lot of discussions about this.
The specs of open()
specify that all files are streamed files.
I don't recall when the change of access
was implemented. However, using mode
argument is a good idea IMO to deal with that. Do you have any suggestions?
Another possibiliy would change the logger to accept streamed files, if possible (@wclodius2).
select case (mode_(4:4))
case('u'); access_ = 'sequential'
case('d'); access_ = 'direct'
case('s'); access_ = 'stream'
end select
I tried to parse the access
into mode
of the open
function, and the default mode
is now rts
. I submitted my branch here.
I refer to the open function of python: open
Among them, python abandoned
u (universal)
mode, which is sequential access
in fortran.
But I think 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.
Describe the issue
I tried to use the
stdlib_logger
module, and used theopen
function instdlib_io
, and found that there was an adaptability problem. The root cause was thatstdlib_logger
required to open the log file asaccess=sequential
, while thestdlib_io:open
function defaulted to open the file asaccess=stream
, I was wondering if this is a problem and how to solve this problem?Links