[J3] Conditional expressions using intrinsic function

Robert Corbett rpcorbett at att.net
Sun Jun 27 07:33:49 UTC 2021


The intrinsic function MERGE
almost works as a conditional
expression.  If the MASK
argument is scalar, most
implementations evaluate
only one of TSOURCE and
FSOURCE.

I proposed adding a function
COND that acted as a
conditional expression.  COND
had the form

COND(predicate, tsource, fsource)

My proposal did not get much
support.

I would like to see how
short-circuit evaluation would
be implemented using your
scheme.  How would the
statements

IF ( p1 .AND. p2 .AND. p3 ) THEN

and

IF ( p1 .OR. p2 .OR. p3 ) THEN

where .AND. and .OR. are
short-circuit operators be
translated into your
scheme.

Which of the three forms
in papers 21-157 and 21-159
was the most popular?

Robert Corbett

> On Jun 26, 2021, at 10:20 PM, Ondřej Čertík via J3 <j3 at mailman.j3-fortran.org> wrote:
> 
> Hi,
> 
> We have uploaded another syntax paper for the conditional expressions:
> 
> https://j3-fortran.org/doc/year/21/21-165.txt
> 
> and answered common past objections there. If possible, we would like it to be considered on Monday (does not have to be a formal vote, but as an alternative to the other proposed syntax papers).
> 
> Ondrej



More information about the J3 mailing list