D needs to be honest
Steven Schveighoffer
schveiguy at gmail.com
Mon Oct 29 15:38:24 UTC 2018
On 10/29/18 12:58 AM, Jonathan Marler wrote:
> I filed this issue (https://issues.dlang.org/show_bug.cgi?id=18517)
> about 8 months ago. It provides a couple test cases that show that
> import order changes the semantics of D programs and the order in which
> modules are passed to the compiler also changes semantics. This
> behavior has existed long enough that it's probably time for D to remove
> and/or qualify some of its claims. Statements like:
>
> https://dlang.org/spec/module.html
>
>> The order in which ImportDeclarations occur has no significance.
>
>> The order in which modules are imported does not affect the semantics.
>
> The bugzilla issue above shows cases where these statements are
> demonstrated to be false, and I wouldn't characterize the issue as a
> bug, rather, a fundamental problem with the way D handles module
> imports. The language definition as it exists does not allow import
> order to be invariant. Note there are a number of ways to fix this
> issue (see PRs below) but note that they do require changes to the way D
> handles imports.
>
>> The semantics of a module are not affected by what imports it.
>
> The module name and or the namespace it exists in will change depending
> on how the module is imported. It can change depending on if it was
> passed in on the command line, or loaded from an import by another
> module, and the path from which it was loaded can change depending on
> which module loaded it first.
The honest thing is that these are bugs plain and simple. I would never
expect or try to explain away the behavior your examples showed.
I changed the issue report from 'enhancement' to 'normal' appropriately.
-Steve
More information about the Digitalmars-d
mailing list