[J3] Comments in list-directed input?

Malcolm Cohen malcolm at nag-j.co.jp
Fri Aug 5 01:41:52 UTC 2022

I think this would likely be confusing no matter how we do it.




Input 1:

   123 !Integer value

   456 !Char value


Result 1:

   123 is assigned to INTVAR, ‘!Integer’ is assigned to CHARVAR, records 2 and 3 not read


That is, the problem is not “within a value”; at least if we follow the rule for namelist (which not all vendors do), a comment is only allowed after a value separator, not tacked-on to the end of a value.


That is, this would depend on what the type of the next value is going to be. Ugh.


I can see why one would like to have comments, but I see no reasonable way of getting there from here without confusion, complexity, or incompatibility (pick at least one). It’s just not worth it.




..............Malcolm Cohen, NAG Oxford/Tokyo.


From: J3 <j3-bounces at mailman.j3-fortran.org> On Behalf Of Van Snyder via J3
Sent: Friday, August 5, 2022 5:11 AM
To: j3 at mailman.j3-fortran.org
Cc: Van Snyder <van.snyder at sbcglobal.net>
Subject: Re: [J3] Comments in list-directed input?


On Thu, 2022-08-04 at 18:28 +0000, Bleikamp, Richard via J3 wrote:

[AMD Official Use Only - General]


Hi Van,


A non-delimited character value, in list-directed input records, can currently be a single “!”, or “!xxx” where “x”s are rep-chars.  “!” is a valid rep-char.  So, allowing a “!” to initiate a comment-to-end-of-line would introduce an incompatibility with Fortran 2018/…


I had in mind NOT introducing an incompatibility. Something like


"! not within a non-delimited character value introduces a comment."


Maybe a NOTE "Watch out! That thing that looks like a comment might be part of a non-delimited character variable's input value!" would be appropriate too.


If we were to introduce a new mode for list-directed input, where all character values were required to be delimited with ‘ or “, then we could easily support ! comments in those records.  


Unless we were going to eventually obsolete list directed input of non-delimited character values, I wouldn’t be thrilled with adding a new mode.




From: J3 <j3-bounces at mailman.j3-fortran.org <mailto:j3-bounces at mailman.j3-fortran.org> > On Behalf OfVan Snyder via J3
Sent: Wednesday, August 3, 2022 11:54 PM
To: j3 <j3 at j3-fortran.org <mailto:j3 at j3-fortran.org> >
Cc: Van Snyder <van.snyder at sbcglobal.net <mailto:van.snyder at sbcglobal.net> >
Subject: [J3] Comments in list-directed input?


[CAUTION: External Email] 

We allow comments in namelist input.


In list-directed input, one can put comments after the last item desired by putting them after the slash that terminates the input.


If one is reading several arrays, say one array per line, with one list-directed input statement, one cannot put a slash and comment on each line because that terminates the input.


Would there be a problem to allow comments in list-directed input, beginning with "!" as in namelist input?


Is this a tiny enough change to get added to the "really tiny stuff tacked onto the next standard outside the big projects" list?


As is the case with the slash, if one is reading a character variable, and not including quotes or apostrophes, you risk reading the comment.



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.j3-fortran.org/pipermail/j3/attachments/20220805/70cfe6eb/attachment-0001.htm>

More information about the J3 mailing list