(j3.2006) internal writes to deferred length strings?
Van Snyder
Van.Snyder
Fri Jul 28 14:38:16 EDT 2017
On Fri, 2017-07-28 at 13:28 +0000, Clune, Thomas L. (GSFC-6101) wrote:
> I?m a big fan of deferred length strings and now use them heavily in
> my code. Having said that, there are few use cases where the
> existing functionality is a bit frustrating. The most common one is
> the following:
>
>
>
>
> character(len=:), allocatable :: string
> character(len=10000) :: buffer ! big enough?
> integer :: list(3)
>
....
> Any thoughts/opinions?
In 1997 at meeting 142 I advocated to allow to specify a procedure that
handled the I/O, either on its own or in a conspiracy with the format
cracker. The applications I had in mind at the time included graphics
and communication. Allocating just the right size buffer for internal
I/O is a smaller problem that could easily be handled by this scheme.
This wasn't in 97-114r2. I mentioned it during a subgroup meeting. One
of the delegates was horrified. He said vendors had gone to strenuous
extents to make it especially difficult to intercept the underlying I/O
routines.
To fill in the details using more explicit and modern terminology, the
routine ought to be a coroutine with a CLASS(*) argument for the object
and a CLASS(*) argument for the unit. For formatted I/O, a character
argument would provide the current format item. If we had done this in
1997, we wouldn't have done DTIO.
Once coroutines exist (and the relationship between an I/O list and a
format is already a coroutine relationship), allowing to specify one in
the I/O statement control list doesn't seem to be much of a burden for
developers. Then we could print the DTIO stuff in obsolescent font.
> - Tom
>
>
> _______________________________________________
> J3 mailing list
> J3 at mailman.j3-fortran.org
> http://mailman.j3-fortran.org/mailman/listinfo/j3
More information about the J3
mailing list