Fortran-FOSS-Programmers / Fortran-FOSS-Programmers/Fortran-202X-Proposals

Proposal: More flexible SELECT TYPE

Open
#7 1 comment 5 reactions 0 assignees View on GitHub
Dominant language
No language data
Stars
21
Forks
0
PR merge metrics
No merged PRs in 30d

Description

Something so we can avoid these annoying nested `select type` blocks.

So if you want to check if several variables are integers:

```fortran
! if several variables are integers
select type (a,b,c) ! new syntax
class is (integer)
d = a + b + c
end select
```

Or if you want to check if a variable is any integer kind:

```fortran
select type (a)
class is (integer(kind=*)) ! new syntax
d = a * 2
end select
```

Or any numeric kind:

```fortran
select type (a)
class is (integer(kind=*), real(kind=*)) ! new syntax
d = 1 * 2
end select
```

And all together:

```fortran
select type (a,b,c) ! new syntax
class is (integer(kind=*), real(kind=*)) ! new syntax
! a, b, and c are all either integers or reals,
! so compiler knows what to do here:
d = a + b + c
end select
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reviewing the proposed SELECT TYPE examples in the issue and the relevant Fortran standard rules. No repository files or tests are identified, so first determine where a language proposal should be specified and validated. Done means reaching agreement on the syntax and semantics for multiple variables, wildcard kinds, and multiple intrinsic types.

Written by the indexing model from the issue text.

Assessment

Tech stack
fortran
Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.