j3-fortran / fortran_proposals

Proposals for the Fortran Standard Committee
175 stars 14 forks source link

Why enforce C1406? #245

Closed klausler closed 2 years ago

klausler commented 2 years ago

"C1406 (R1409) A scoping unit shall not directly reference an intrinsic module and a nonintrinsic module of the same name."

It might be confusing to have (say) a user-defined ISO_FORTRAN_ENV module in a program and reference it in a scope along with the intrinsic module of the same name, but so long as the USE statements are qualified with INTRINSIC and NON_INTRINSIC, there's no ambiguity. So why impose this constraint? It feels a bit like a restriction from an early implementation was resolved by fiat.

(The constraint would have some justification if Fortran had module-qualified name references, but it doesn't.)

klausler commented 2 years ago

One possible justification for C1406 has occurred to me: after the first USE, INTRINSIC or USE, NON_INTRINSIC of a particular module name in a scoping unit, later USE statements of the same module name don't have to also include the explicit INTRINSIC/NON_INTRINSIC. It's not much, but it's reasonable. Closing this issue.