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

Proposal: Default value for allocatable derived type component

Open
#3 0 comments 3 reactions 0 assignees View on GitHub
Dominant language
No language data
Stars
21
Forks
0
PR merge metrics
No merged PRs in 30d

Description

Allow for the default state of allocatable variables to be allocated with a specified value:

```fortran
type my_type
integer :: i = 1 ! this has "always" been possible
character(len=:),allocatable :: str = 'default' ! this is not currently possible
end type my_type
```

This would also enable parameters:

```fortran
type(my_type),parameter :: t1 = my_type(1,'option 1')
type(my_type),parameter :: t2 = my_type(2,'option 2')
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the allocatable derived-type component and parameter examples in the issue. Research the Fortran rules governing default component initialization and constant derived-type parameters, then define the proposal's required semantics and any affected examples; done means the proposal is sufficiently specified for standard discussion.

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
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.