[Dlang-internal] Issue 7616: intentional or fix welcome?

Neia Neutuladh neia at ikeran.org
Thu Dec 20 05:49:54 UTC 2018


On Wed, 19 Dec 2018 21:02:20 -0800, Walter Bright wrote:
> There was a good reason it is the way it is, but I don't recall just
> what it was. Sigh.

After spelunking through git (thanks git log -L!), I found out how the 
source code came to look like it does:

https://issues.dlang.org/show_bug.cgi?id=5110

The 'override' keyword propagated to functions defined inside nested 
classes:

class Foo
{
  override:
  string toString() { return ""; }
  class Bar
  {
    // error: doStuff doesn't override any function
    void doStuff() {}
  }
}

Some amount of filtering was strongly suggested. (The spec was not updated 
with this change.)

Shin Fujishiro thought it was awkward for pure and nothrow to propagate to 
structs because there was no way to turn them off. Because of that, they 
chose to filter out pure and nothrow. This allowed you to be more flexible 
withh aggregates, but it did nothing for free functions; you still 
commonly need to reorder declarations or use `pure {}` or set the 
attributes on each item individually.

So there *was* a reason; whether it's a good one or not is a matter of 
opinion.

Does this mean a DIP is required?


More information about the Dlang-internal mailing list