j3-fortran / fortran_proposals

Proposals for the Fortran Standard Committee
178 stars 15 forks source link

NAMELIsT should be allowed in BLOCK constructs #132

Open urbanjost opened 4 years ago

urbanjost commented 4 years ago

This should be allowed:

BLOCK NAMELIST /PRINT/ A,B,C WRITE(*,PRINT) ENDBLOCK

One use of this could be for constructing debugging sections, as in

if(debug)then block namelist /print/a,b,c write(,print) write(,)' change values' read(,print) endif endblock

were you can create a local namelist to just print a subset of values in a self-describing format that can easily be read into other ad-hoc programs to analyze, for example.

FortranFan commented 4 years ago

@urbanjost,

The title here refers to NAMELIST facility in a BLOCK construct but the original post includes a second aspect (Another useful extension would be able to just print part of a NAMELIST ..) also which is unrelated to BLOCK constructs.

Can you cut out the 2nd aspect and start a separate issue for it?

urbanjost commented 4 years ago

Thanks. Getting my feet wet in how best to do this. The NAMELIST request(s) seemed like an easy one to start with. It was not clear to me whether to group a number of related requests into a single page, whether there was a formal template to use or whether the intent was to start with a simple suggestion and let the dialog develop organically (which is preferable I think, to nip some things in the bud before putting to much time into them if they are not viable, etc ... versus putting in a high enough bar to keep the volume of requests to a mininum, etc). Saw examples of different approaches in the existing requests but not much mention if one approach was preferred over another or whether all approaches were welcome.

FortranFan commented 4 years ago

Per my comments at comp.lang.fortran thread where this was posed as a question earlier, I support this.

My view is the semantics of the BLOCK construct is not all that much different from a CONTAINed subprogram and if the following is permitted, then NAMELISTs can be allowed in BLOCK also and that will be a useful facility for many a practitioner of Fortran.

certik commented 3 years ago

A paper has been submitted to the June 2021 J3 meeting:

Unless I am mistaken, it is the same feature. The committee did not allow discussion on the paper at the meeting itself, because it is for 202Y, not 202X; but it invited committee members to provide feedback here on GitHub.