..reckon covers your inquiry here also: you know the drill, for further details there is the standard and the words in it.
There was a discussion at the J3 Fortran mailing list a couple of months ago *where* the editor of the standard (and the chair of the /DATA subgroup) and the de facto final authority on such matters in the language chimed in and whose brief response I
https://mailman.j3-fortran.org/pipermail/j3/2022-August/013836.html
F'2018 subclause 19.3.4 paragraph 1 says that "A component name has the scope of its derived-type definition" which seems pretty clear to me, but it doesn't seem to apply in the way that I would expect with many Fortran compilers. Shouldn't all ofthese uses of component names in a derived type definition resolve to the components with those names, rather than to the names in the enclosing scope? ..
19.3.4 "A component name has the scope of its derived-type definition. Outside the type definition, it may also appear within a designator of a component of a structure of that type or as a component keyword in a structure constructor for that type."
That first sentence must mean *something*, and the second sentence's "it may also appear" implies that a component name *can* appear with a derived type definition.
On Friday, October 14, 2022 at 2:56:29 PM UTC-4, Peter Klausler US wrote:
19.3.4 "A component name has the scope of its derived-type definition. Outside the type definition, it may also appear within a designator of a component of a structure of that type or as a component keyword in a structure constructor for that type."
That first sentence must mean *something*, and the second sentence's "it may also appear" implies that a component name *can* appear with a derived type definition.You can seek further clarification with the committee but chances are nearly 100% that
a) re: "That first sentence must mean *something*", the "something" will *not* extend to instructions such as 'integer(kind(foo)) bar' in the code snippet in your original post.
b) re: "the second sentence's "it may also appear"" does not refer to "type definition" but to a "structure" and a constructor for it where the "structure" - per the standard - is a scalar data object of a derived type.
F'2018 subclause 19.3.4 paragraph 1 says that "A component name
has the scope of its derived-type definition" which seems pretty clear to me, but it doesn't seem to apply in the way that I would expect with many
Fortran compilers. Shouldn't all of these uses of component names in a derived type definition resolve to the components with those names,
rather than to the names in the enclosing scope?
type t
integer(kd) foo
integer(kind(foo)) bar
integer(k1) :: baz = kind(foo)
integer :: quux = kind(baz)
end type
It is hard for compiler writers to get this right, and so
my best guess is 50% chance you are right and the compiler
wrong.
On Friday, October 14, 2022 at 12:46:26 PM UTC-7, FortranFan wrote:
..
b) re: "the second sentence's "it may also appear"" does not refer to "type definition" but to a "structure" and a constructor for it where the "structure" - per the standard - is a scalar data object of a derived type.https://dictionary.cambridge.org/us/dictionary/english/also - adverb, "in addition to".
Further, type parameter names of a type are in exactly the same scope as its component names, and type parameter names obviously can be used in the scope of a type definition.
https://dictionary.cambridge.org/us/dictionary/english/also - adverb, "in addition to".The "standardese" charters its own course, it feels free to supersede the dictionary or ordinary usage of terms and phrases.
On Saturday, October 15, 2022 at 8:09:45 AM UTC-7, FortranFan wrote:
Ok, if you've altered the meaning of the word "also" in the standard, what does it now mean in this context?https://dictionary.cambridge.org/us/dictionary/english/also - adverb, "in addition to".The "standardese" charters its own course, it feels free to supersede the dictionary or ordinary usage of terms and phrases.
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 159 |
Nodes: | 16 (0 / 16) |
Uptime: | 99:59:10 |
Calls: | 3,209 |
Files: | 10,563 |
Messages: | 3,009,979 |