-
Notifications
You must be signed in to change notification settings - Fork 17
Default value for allocatable derived type component #39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@jacobwilliams thanks for reporting it. This is related to #22 a bit. I thought that when you write |
I think, as long as it is an assignment in a derived type declaration, it does not have any direct implications for the |
Implicit However, now I realize that in the context of default value for derived type components, which I've been happily using for years, the type constructor uses the same style as proposed in #22. For example: type my_type
integer :: i = 1
end type my_type
type(my_type) :: t1 = my_type() ! this works, t1 % i is 1
type(my_type) :: t2 = my_type(3) ! this works also, t2 % i is 3 So, the proposal #22 (sorry to hijack the thread :)) is consistent with the current syntax for default values of derived type components, except there we need an extra attribute ( I like this proposal also. It could be merged with #22, or have two separate smaller proposals. We should make whatever is easier to digest by the committee. |
Frankly, I think the implicit save behavior should be removed. It is a malicious anti-feature of the language. But, of course it will be be with us until the end of time (like implicit typing I suppose). |
@jacobwilliams I created #40 for removing the implicit save behavior. |
Allow for the default state of allocatable variables to be allocated with a specified value:
I'd also like to be able to define parameters with allocatable components like so:
The text was updated successfully, but these errors were encountered: