# Will FORALL be deleted?

**URL:** <https://fortran-lang.discourse.group/t/will-forall-be-deleted/1272>\
**Category:** Uncategorized\
**Created:** [May 21, 2021, 3:31pm UTC](https://fortran-lang.discourse.group/t/will-forall-be-deleted/1272 "2021-05-21T15:31:44Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Beliavsky](https://avatars.discourse-cdn.com/v4/letter/b/ba8739/32.png) [@Beliavsky](https://fortran-lang.discourse.group/u/Beliavsky)\
**Post date:** [May 21, 2021, 3:31pm UTC](https://fortran-lang.discourse.group/t/will-forall-be-deleted/1272/1 "2021-05-21T15:31:44Z")

</div>

FORALL is obsolescent in Fortran 2018. I believe that is because the initial aim of helping compilers parallelize code has not been realized and because DO CONCURRENT is now available.

I still like FORALL and hope it will be retained, because it is concise and indicates that the operations within can be done in any order. I see that a GSOC student has implemented it in LFortran.

How likely is it that FORALL will be deleted in future standards? The F2018 interpretation [says](https://j3-fortran.org/doc/year/18/18-007r1.pdf) “A future revision of this document might delete an obsolescent feature if its use has become insignificant.”

---

<div class="post-metadata">

**Author:** ![shahmoradi](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/shahmoradi/32/3151_2.png) [@shahmoradi](https://fortran-lang.discourse.group/u/shahmoradi)\
**Post date:** [May 21, 2021, 4:35pm UTC](https://fortran-lang.discourse.group/t/will-forall-be-deleted/1272/2 "2021-05-21T16:35:52Z")

</div>

Even if the standard deletes `forall`, I doubt if compilers will ever do so.

---

<div class="post-metadata">

**Author:** ![sblionel](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/sblionel/32/853_2.png) [@sblionel](https://fortran-lang.discourse.group/u/sblionel)\
**Post date:** [May 21, 2021, 7:11pm UTC](https://fortran-lang.discourse.group/t/will-forall-be-deleted/1272/4 "2021-05-21T19:11:06Z")

</div>

Certainly, FORALL is eligible for deletion, but I doubt it will happen. I know that several on the committee agree with me that deleting features from the language is counter-productive. As @shahmoradi notes, compilers won’t drop support and deletion removes any text that explains how the deleted feature works with other parts of the standard.

---

<div class="post-metadata">

**Author:** ![certik](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/certik/32/4_2.png) [@certik](https://fortran-lang.discourse.group/u/certik)\
**Post date:** [May 21, 2021, 7:35pm UTC](https://fortran-lang.discourse.group/t/will-forall-be-deleted/1272/5 "2021-05-21T19:35:42Z")

</div>

Indeed, as others said, compilers most likely won’t remove the support for it, and even new compilers being developed (such as LFortran that you mentioned) have to implement it, because existing codes use it.

Once a feature is standardized and some codes start to use it, it has to be supported pretty much forever in practice by compilers. It is for this reason that I encourage the Standards Committee (myself included) to be extra “conservative” when adding any new feature into the language, because it is “forever”, and so it should be “worth it”.

---

<div class="post-metadata">

**Author:** ![certik](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/certik/32/4_2.png) [@certik](https://fortran-lang.discourse.group/u/certik)\
**Post date:** [May 21, 2021, 7:46pm UTC](https://fortran-lang.discourse.group/t/will-forall-be-deleted/1272/6 "2021-05-21T19:46:11Z")

</div>

> [@pmk](#):
>
> You seem to think that `DO CONCURRENT` is a parallel execution construct.

Indeed, the standard specifies that the iterations can be executed in any order, but not necessarily always in parallel (i.e., intermingled). See this answer by Robert Corbett in the J3 mailinglist for more details:

[[J3] Questions about DO CONCURRENT and locality](https://mailman.j3-fortran.org/pipermail/j3/2020-July/012236.html)

---

<div class="post-metadata">

**Author:** ![FortranFan](https://avatars.discourse-cdn.com/v4/letter/f/96bed5/32.png) [@FortranFan](https://fortran-lang.discourse.group/u/FortranFan)\
**Post date:** [May 21, 2021, 8:02pm UTC](https://fortran-lang.discourse.group/t/will-forall-be-deleted/1272/8 "2021-05-21T20:02:20Z")

</div>

> [@Beliavsky](#):
>
> … I still like FORALL and hope it will be retained …

In fact there is a strong argument to be made to **undo** the obsolescence of `FORALL`, it is effectively just a label in the standard, and it can just as readily be removed as applied. For all the compilers worth their salt are going to support it any way!

The point in the standard about it being redundant with `DO CONCURRENT` is not quite accurate. `FORALL` is both a statement and a construct; the former is handy.

In this [**thread**](https://fortran-lang.discourse.group/t/problem-with-array-definition/1163/8), I was quite tempted to suggest `FORALL` but I didn’t only on account of its label in the standard:

```Fortran
forall (integer :: i=1:size(a)) a(i) = xx ! where xx is a valid const-expr 

```

---

<div class="post-metadata">

**Author:** ![FortranFan](https://avatars.discourse-cdn.com/v4/letter/f/96bed5/32.png) [@FortranFan](https://fortran-lang.discourse.group/u/FortranFan)\
**Post date:** [May 21, 2021, 10:49pm UTC](https://fortran-lang.discourse.group/t/will-forall-be-deleted/1272/10 "2021-05-21T22:49:09Z")

</div>

> [@pmk](#):
>
> …`a(:) = xx` even more so.

`a(:) = xx` is not all better in our experience where  
a) the array section notation (`:`) has been found to be confusing and practitioners misunderstand and/or misuse it;  
b) depending on the expression(s) presented with `xx`, the array assignment can involve array constructor or ac-implied-do on the RHS that both compilers and coders haven’t always handled well, and  
c) there are situations with certain loop-based assignments involving expressions, especially in certain environments with mixed-language applications, where code reads better left-to-right and the `FORALL` **statement** serves the needs well.

---

<div class="post-metadata">

**Author:** ![FortranFan](https://avatars.discourse-cdn.com/v4/letter/f/96bed5/32.png) [@FortranFan](https://fortran-lang.discourse.group/u/FortranFan)\
**Post date:** [May 22, 2021, 12:31am UTC](https://fortran-lang.discourse.group/t/will-forall-be-deleted/1272/12 "2021-05-22T00:31:54Z")

</div>

In that other thread and here, my responses have qualified the RHS for the broader scenarios of fairly common interest to practitioners.

---

<div class="post-metadata">

**Author:** ![billlong](https://avatars.discourse-cdn.com/v4/letter/b/71e660/32.png) [@billlong](https://fortran-lang.discourse.group/u/billlong)\
**Post date:** [May 22, 2021, 4:43am UTC](https://fortran-lang.discourse.group/t/will-forall-be-deleted/1272/13 "2021-05-22T04:43:27Z")

</div>

In recent years there has been a high bar for actually deleting features. Particularly if compilers still support the feature because old codes use it. The point of obsolescent is to _discourage_ new use of the feature. An example of a deleted feature that comes to mind was the arithmetic IF statement, since its semantics depend on \> and \< tests that became problematic when the concepts of IEEE arithmetic (with NaN) were introduced into the standard. Similarly, the PAUSE statement was deleted because its purpose had an implicit assumption that the person running the program was sitting at the computer’s console. Not the case anymore, in actual practice.
