December 17, 2022
https://issues.dlang.org/show_bug.cgi?id=15086

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P1                          |P2

--
December 24, 2022
https://issues.dlang.org/show_bug.cgi?id=15086

Adam D. Ruppe <destructionator@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |destructionator@gmail.com

--- Comment #29 from Adam D. Ruppe <destructionator@gmail.com> ---
A rule I've written before is any module you import MUST have a module declaration. The language doesn't require this but it really should, the implicit module name hack has never worked well.

--
December 25, 2022
https://issues.dlang.org/show_bug.cgi?id=15086

--- Comment #30 from Walter Bright <bugzilla@digitalmars.com> ---
Another PR for it:

https://github.com/dlang/dmd/pull/7878

--
June 30, 2023
https://issues.dlang.org/show_bug.cgi?id=15086

--- Comment #31 from ag0aep6g <ag0aep6g@gmail.com> ---
I just ran into this one again in the wild.

Step 1: Start with a program that prints some data as an HTML table.

Step 2: Add another module to print the same data in CSV format. Do this by copying html.d to csv.d and adjust as needed. Make sure you forget updating the module declaration.

The resulting code (heavily simplified, of course):

--- main.d
module main;
void main()
{
    const mode = "html";
    if (mode == "csv")
    {
        import csv;
        print();
    }
    else if (mode == "html")
    {
        import html;
        print();
    }
}
--- csv.d
module html; /* oopsie daisy */
void print()
{
    import std.stdio;
    writeln("foo,bar\nbaz,qux");
}
--- html.d
module html;
void print()
{
    import std.stdio;
    writeln("<table><tr><td>foo</td><td>bar</td></tr>" ~
        "<tr><td>baz</td><td>qux</td></tr></table>");
}
---

Step 3: Run with `dmd -i -run main.d`. Be surprised that it prints CSV even though `mode` is clearly set to "html". Scratch your head. Stare at the screen. Question your sanity.

Finally, figure out that you forgot to update the module declaration. Wonder
why the compiler didn't complain. Remember that bug you filed seven(!) years(!)
ago.

--
1 2 3 4
Next ›   Last »