I would say this is confusing at best. The "a", "b", and "c" variables
are logical, and used to set j, which is only used to select the call.
But sub() is always called with .true. present arguments and .false'
nonpresent arguments (assuming that syntax even works), so why not just have
call sub(a,b,c)
to cover all the cases? The arguments have .true. or .false. values,
which the subprogram can test in the straightforward way. No need for
optional attributes, where the present dummy arguments are always .true.
and the nonpresent arguments are always .false.
On the other hand, if "a", "b", and "c" are themselves optional
arguments (of any type), then
call sub(a,b,c)
passes their present() status down to sub() in the straightforward way.
This is a very useful feature of the language (since f90).
An example of the conditional expression is
call sub( (<expression> ? a : b) )
which is equivalent to
if ( expression ) then
call sub(a)
else
call sub(b)
endif
Now consider a subroutine with more than one such argument. Each
argument would double the number of possible if-then-else branches
(O(2^N) coding effort) required to select the correct calling sequence,
but it can be done with a single call using the multiple conditional
expressions (O(N) coding effort). Further, this cannot be done with
MERGE, because the result of MERGE is an modifiable expression. That
means it can be associated with intent(out) and intent(inout) dummy
arguments, and the updated values are passed back to the calling program
correctly through the argument association.
This could also be achieved with pointers, conditionally assigning each
pointer actual argument. That approach also requires O(N) rather than
O(2^N) coding effort. However that would require that the possible
arguments all be targets, which suppresses optimization in the same way
that C, C++, etc. languages have suppressed optimization due to wild
pointers.
In my opinion, the fact that the result is modifiable is the real useful
feature of the conditional expression semantics. When used to replace
MERGE or IF-THEN-ENDIF, it is mostly, apart from the short-circuit
feature, just redundant eye candy.
$.02 -Ron Shepard