[J3] [EXTERNAL] Re: Value separators
Dan Nagle
danlnagle at mac.com
Wed Feb 15 15:38:06 UTC 2023
Hi,
As one of the principle movers of some of these features, one short comment.
My motive was to allow a diligent programmer to make communications work,
not to solve all csv problems. I always assumed that the programmer would have
control of both sides. I never thought Fortran could easily match
the (several pages of) csv options in some spreadsheets.
A scientist may well want a quick look at the output, and the graphics abilities
of R or a spreadsheet are just sitting there.
> On Feb 2, 2023, at 17:44, Malcolm Cohen via J3 <j3 at mailman.j3-fortran.org> wrote:
>
> Hi Tom,
> No, Van was not indicating a fundamental obstacle. Unless you mean the fundamental obstacle that “list-directed” is simple and processor-dependent, and “csv files” are complicated and not the same as list-directed.
> That list-directed actually works when reading a csv file that contains only numeric fields is a convenience.
> My comments were just that the suggestion did not extend the convenience to cover all csv files anyway, and that one would want a separate facility if it were to be built-in to the language.
> Of course there is nothing standing in the way of implementing with a library, other than using one would inevitably not be quite as simple and convenient as list-directed (or a similar built-in facility). Does that mean we *should* have a built-in facility? I did not express an opinion on the matter, but it’s not hard to guess what it would be.
> Cheers,
> -- ..............Malcolm Cohen, NAG Oxford/Tokyo.
> From: J3 <j3-bounces at mailman.j3-fortran.org> On Behalf Of Clune, Thomas L. (GSFC-6101) via J3
> Sent: Friday, February 3, 2023 3:45 AM
> To: General J3 interest list <j3 at mailman.j3-fortran.org>
> Cc: Clune, Thomas L. (GSFC-6101) <thomas.l.clune at nasa.gov>
> Subject: Re: [J3] [EXTERNAL] Re: Value separators
> Gary,
> I agree. Separate library would seem the better way to approach this issue. But Van was indicating there may be some fundamental obstacles to implementing a general purpose library, and I took Malcolm’s comments as implying that this was indeed the case.
> I know that for JSON, YAML, and XML that no new features are required, as there are existing compliant implementations in Fortran for these formats.
> Cheers,
>
> • Tom
> From: J3 <j3-bounces at mailman.j3-fortran.org> on behalf of j3 <j3 at mailman.j3-fortran.org>
> Reply-To: j3 <j3 at mailman.j3-fortran.org>
> Date: Thursday, February 2, 2023 at 1:40 PM
> To: j3 <j3 at mailman.j3-fortran.org>
> Cc: Gary Klimowicz <gak at dancingbear.dev>
> Subject: [EXTERNAL] Re: [J3] Value separators
> On Feb 2, 2023, at 07:13, Steve Lionel via J3 <j3 at mailman.j3-fortran.org> wrote:
>>
>>
>> Reading CSV files is far more complex than dealing with value separators. Fields can be dates, times, currencies and more. Yes, some programs that write CSVs offer the option to enclose strings in quotes, but many do not. Trying to shoehorn this into list-directed (or even formatted) input would be a mistake.
>> I think that we already have an effective tool for reading CSVs in the new SPLIT intrinsic. This has you specify the delimiter(s) you want to look for and allows you to make interpretation choices on a column by column basis.
>> As for writing CSVs, that's what we put in unlimited repeat count and G0 for. Is it perfect? No. But it is a useful tool that satisfies many needs.
>
> As useful as this would be, it doesn't feel like something that needs the be included in the language standard.
> Next requests could be list-directed support for JSON, or YAML, or XML, or S-expressions.
> It feels more like something we would like a really excellent library for.
> (The exercise is left for the reader. I'll be working on S-expressions.)
--
Cheers!
Dan Nagle
More information about the J3
mailing list