Quantcast
Channel: Intel® Fortran Compiler
Viewing all articles
Browse latest Browse all 3270

Files as Objects / A comment for discussion

$
0
0

Dear All,

Since Fortran tends to be more and more object-oriented, I consider to be useful to have some kind of default objects that are related to external files. For example a default type external_file that:
A. holds data related to the file, such as the integer:unit, logical:opened, logical:exists its specifiers
B. legacy subroutines are now type-bound procedures open,close,inquire

I think that this could provide an improved functionality. For example, the files a program/subprogram is using, can be clearly stated in the declarations type(external_file) :: my_input, my_output. Another example is generating and managing many files simultaneously while at the same time it provides very simple bookkeeping mechanics. Say for example that I need a variable number of files to be opened, then this could be something like type(external_file), dimension(:), allocatable :: my_files. Moreover consider a case that I would like all of these files to have the same specifiers. I could define them all at once in the beginning of the code, e.g. my_files%access="stream". So let me know what is your opinion, do you think that it would be a useful Fortran feature? 

Thanks for sharing!

Kostas

( NOTE: In the new "User and Reference Guide", table of the open statement specifiers, the "stream" keyword is missing http://software.intel.com/en-us/node/465332 )


Viewing all articles
Browse latest Browse all 3270

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>