(j3.2006) Defined operation questions

Bill Long longb
Wed May 9 08:23:12 EDT 2012



On 5/8/12 4:03 PM, Van Snyder wrote:
> Does anybody remember why "nonoptional" is required for dummy arguments
> of functions that define operations (12.4.3.4.2p1)?
>
> I tried to write an .ANDTHEN. operator with an optional second argument,
> so that I could do something like "if ( present(A) .ANDTHEN. A )...", in

Can't you just write

   if (present(A)) then; if (A) then
   ...

   end if; end if

It works now, is clear,  and would be faster than invoking a procedure 
reference.


> which the function that defines .ANDTHEN. returns false without
> referencing the second argument if the first argument is false. I can't
> do this because the function that defines .ANDTHEN. can't have an
> optional second argument, and therefore can't be invoked if A is not
> present.
>
> I can understand requiring the second actual argument to /appear/ in a
> reference (as already required by the syntax rules in Clause 7), but why
> must it be /present/?
>
> In light of the first distinguishing characteristic in 12.4.3.4.5p3, is
> there still a reason for "data object" in (12.4.3.4.2p1)?

The criterion for a few feature should not be "I can't think of a reason 
why not".   We often overlook, or don't realize at the time, the 
implementation costs of such whims and (at least vendors) regret it later.

Cheers,
Bill


>
> I can't offhand think of an application for a defined operation in which
> one operand is a procedure, but there appears not to be a problem with
> generic resolution.
>
> --
> Van Snyder                                        |    What fraction of Americans believe
> Van.Snyder at jpl.nasa.gov  <mailto:Van.Snyder at jpl.nasa.gov>              |    Wrestling is real and NASA is fake?
> Any alleged opinions are my own and have not been approved or
> disapproved by JPL, CalTech, NASA, the President, or anybody else.
>
>
>
> _______________________________________________
> J3 mailing list
> J3 at j3-fortran.org
> http://j3-fortran.org/mailman/listinfo/j3

-- 
Bill Long                                           longb at cray.com
Fortran Technical Support    &                 voice: 651-605-9024
Bioinformatics Software Development            fax:   651-605-9142
Cray Inc./Cray Plaza, Suite 210/380 Jackson St./St. Paul, MN 55101





More information about the J3 mailing list