Skip to content

Conditional Expressions #12

@certik

Description

@certik

Initial recent paper: https://j3-fortran.org/doc/year/18/18-274.txt (there is a long history of trying to get something like this standardized).

Motivation

Citing from the paper:
People have wanted to write things like

  IF (I<N .AND. A(I)==0) ...

for decades. So far, we have fobbed them off and they have to write

  IF (I<N) THEN
    IF (A(I)) ...
  END IF

which is not just verbose but less convenient when wishing to test a series
of conditions.

Similarly, writing

  IF (PRESENT(D)) THEN
    CALL SUB(A,B,C,D)
  ELSE IF (X<1) THEN
    CALL SUB(A,B,C,EPSILON(X))
  ELSE
    CALL SUB(A,B,C,SPACING(X))
  END IF

is verbose but usable when only one argument is conditional, but rapidly
degenerates when there are several arguments requiring similar handling.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions