August 04, 2021 [Issue 3345] Static and nonstatic methods with the same name should be allowed | ||||
|---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=3345 --- Comment #22 from Max Samukha <maxsamukha@gmail.com> --- (In reply to Walter Bright from comment #15) > > Otherwise there is no way to explain how .classinfo works in terms of D facilities. > For code like this: > > int fun() { return 1; } > static int fun() { return 2; } > > I cannot understand what purpose there is for writing such code. It is a standard OOP practice. For example, 'Equals' in .NET's root class https://docs.microsoft.com/en-us/dotnet/api/system.object?view=net-5.0#methods. -- | ||||
August 04, 2021 [Issue 3345] Static and nonstatic methods with the same name should be allowed | ||||
|---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=3345 --- Comment #23 from Max Samukha <maxsamukha@gmail.com> --- (In reply to Walter Bright from comment #17) > > But having different error messages depending on the order of declarations is definitely wrong. > > Probably, but it's a minor issue, as both messages are correct. If there is a matching static overload, "need 'this'" without "matches both" is misleading. I've filed https://issues.dlang.org/show_bug.cgi?id=22157 for that. -- | ||||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply