(j3.2006) FINAL subroutines with explicit/assumed-size arrays

Malcolm Cohen malcolm
Wed May 9 01:01:04 EDT 2012


>Tobias Burnus wrote:
>I do have problems with an assumed-size or explicit-size dummy argument of a 
>finalization subroutine.

Just like other generics, a dummy argument is permitted to be assumed-size or 
explicit-shape.

It is true that I would not advise doing that, but then I would not advise using 
those kinds of arrays in other generics either.

Requiring final procedures in particular to have only scalar or assumed-shape 
arrays would have been an inconsistency with other generics.  Admittedly the 
inconsistency is only minor, but when it comes down to making inconsistent 
rules, one needs to have a very good reason for the inconsistency; doing 
otherwise increases the complexity of the language.  No sufficiently good reason 
presented itself at the time.

>However, that only makes sense, if all arrays of a type have the same size (per 
>given rank) , or one passes the array size in a very indirect way (e.g. module 
>variable) - or if one ignores the data completely or partially (e.g. using 
>always only the first array element).

Well there you are - you admitted it could make sense in some contexts.  So we 
would need a Very good reason to make it inconsistent.

It is also true that a program might have a particular convention for using 
variables of the type so that an array would have a built-in sentinel for 
example.  That seems strange if you are thinking of FINAL in terms of a library 
you are providing to the user, but not quite so strange for a program itself, 
even if I would not recommend that style.

Cheers,
-- 
................................Malcolm Cohen, Nihon NAG, Tokyo. 




More information about the J3 mailing list