(j3.2006) polymorphic arguments of intrinsic operators and procedures
Fri Jan 28 02:09:59 EST 2011
Van Snyder wrote:
> On Wed, 2011-01-26 at 00:37 -0800, Robert Corbett wrote:
>>The other side argues that intrinsic functions that take arguments
>>of "any type" and return results that are the same type as one
>>or more of the arguments should accept polymorphic arguments and
>>return polymorphic results. The declared type of the result
>>should match the declared type of the argument, and the dynamic
>>type of the result should match the dynamic type of the argument.
>>This side thinks the following additional functions should accept
>> CSHIFT EOSHIFT MERGE PACK
>> RESHAPE SHAPE SIZE SPREAD
>> TRANSFER TRANSPOSE UNPACK
SHAPE and SIZE do not belong on this list. I do not know why I put
them there. They belong on the first list, which is not controversial
>>In other implmentations, which intrinsic procedures accept
>>polymorphic arguments? By what rationale were these procedures
>>chosen? Is there language in the standard that specifies which
>>intrinsic procedures accept polymorphic arguments that the
>>members of Oracle's Fortran team missed? Which of the schemes
>>described above is more appealing?
> Since most of these can be implemented by fiddling descriptors,
I accept that is true if by "most" you mean "a few." In our
implementation, and I suspect most other implementations, they are
implemented by inline code.
> I don't
> see why they shouldn't be allowed to return polymorphic results.
Implementation is possible.
> On the
> other hand, I can imagine that the dynamic type is in a descriptor, not
> in the object itself, so not returning polymorphic results might be easy
> as well. Will Rogers said he never met a two handed economist, so I'll
> continue... On yet another hand, maybe if you just fiddle the type in
> the descriptor, you have to take extra care to fake the element sizes in
> the descriptor.
None of the implementations I tried treats the results of these
intrinsic functions as polymorphic. Some implementations gave no
diagnostic message for passing polymorphic acutal arguments to the
intrinsic functions, but none allowed the results to be used in
contexts that required polymorphism. I admit I find that strange.
More information about the J3