On Thursday, April 14, 2022 at 1:32:52 AM UTC+1, gah4 wrote:
> On Wednesday, April 13, 2022 at 12:18:31 PM UTC-7, Steve Lionel wrote:
>
> (snip)
> > This is why the "modern Fortran" way is to do initialization on the
> > statement that declares the variable. DATA itself is archaic (though not
> > yet obsolescent), dating from the era of implicit type declarations.
> > Given that there is a newer way to do initialization; one that doesn't
> > require the compiler to stand on its head to make sense of overlapping
> > DATA statements, I see no motive for simply altering the syntax of DATA.
I have made a compiler 'stand on its head' to handle DATA statements, and I agree strongly that the existing syntax has problems. But I don't think that the DATA statement can be replaced by embedded data in declarations in all cases. The following is a fragment from the data construct in fpt which specifies the name labels for intrinsic function and subroutine arguments:
DATA itr_lab_arg(:,k_len)/k_string,0,0,0,0,0/
DATA itr_lab_arg(:,k_index)/k_string,k_substring,k_back,0,0,0/
DATA itr_lab_arg(:,k_char)/k_i,k_kind,0,0,0,0/
DATA itr_lab_arg(:,k_ichar)/k_c,k_kind,0,0,0,0/
DATA itr_lab_arg(:,k_llt)/k_string_a,k_string_b,0,0,0,0/
DATA itr_lab_arg(:,k_lle)/k_string_a,k_string_b,0,0,0,0/
DATA itr_lab_arg(:,k_lgt)/k_string_a,k_string_b,0,0,0,0/
DATA itr_lab_arg(:,k_lge)/k_string_a,k_string_b,0,0,0,0/
DATA itr_lab_arg(:,k_sizeof)/0,0,0,0,0,0/
0 means no pre-defined label name. There is a unique integer value corresponding to every name, with the parameter value k_name. k_name specifies that the name corresponds to the serial position of the argument. There is an entry for every standard intrinsic and every intrinsic in VMS, MPX and HP3000 ... Fortran. There are similar tables for the data type and kind of the intrinsic returns. These have to be maintained by hand - the standard changes. I do not see how this information could be embedded in the declaration of itr_lab_arg. But if it can, I would be very happy!