[Issue 7066] You can redefine .init and .stringof without error
https://issues.dlang.org/show_bug.cgi?id=7066 Iain Buclaw changed: What|Removed |Added Priority|P2 |P4 --
[Issue 7066] You can redefine .init and .stringof without error
https://issues.dlang.org/show_bug.cgi?id=7066 Basile-z changed: What|Removed |Added CC|b2.t...@gmx.com | --
[Issue 7066] You can redefine .init and .stringof without error
https://issues.dlang.org/show_bug.cgi?id=7066 Basile-z changed: What|Removed |Added CC||b2.t...@gmx.com --- Comment #13 from Basile-z --- *** Issue 17465 has been marked as a duplicate of this issue. *** --
[Issue 7066] You can redefine .init and .stringof without error
https://issues.dlang.org/show_bug.cgi?id=7066 hst...@quickfur.ath.cx changed: What|Removed |Added CC||hst...@quickfur.ath.cx --
[Issue 7066] You can redefine .init and .stringof without error
https://issues.dlang.org/show_bug.cgi?id=7066 Nick Treleavenchanged: What|Removed |Added CC||dav...@126.com --- Comment #12 from Nick Treleaven --- *** Issue 1412 has been marked as a duplicate of this issue. *** --
[Issue 7066] You can redefine .init and .stringof without error
https://issues.dlang.org/show_bug.cgi?id=7066 Nick Treleavenchanged: What|Removed |Added CC||n...@geany.org --- Comment #11 from Nick Treleaven --- struct S { string stringof; } // Issue 14237 class MyClass { void init() {}; } `init` and `stringof` should be required to be `static`, as they are expected to work without an instance. They should probably not be allowed to be `void` functions either. --
[Issue 7066] You can redefine .init and .stringof without error
https://issues.dlang.org/show_bug.cgi?id=7066 Nick Treleavenchanged: What|Removed |Added CC||heartcollector...@gmail.com --- Comment #10 from Nick Treleaven --- *** Issue 14237 has been marked as a duplicate of this issue. *** --
[Issue 7066] You can redefine .init and .stringof without error
https://issues.dlang.org/show_bug.cgi?id=7066 Vijay Nayarchanged: What|Removed |Added CC||mad...@gmail.com --- Comment #9 from Vijay Nayar --- I encountered this problem as well while porting a C++ library to D. It took a while to diagnose, but I eventually found out that the mere existence of a function named "init" caused the RefAppender I used in a totally unrelated function to break. Example program: ``` import std.array; struct S1 { // The mere presence of this method causes the error, deleting it fixes the error. void init(string p1, int p2, int p3) { } } struct S2 { S1[] a; RefAppender!(int[]) getAppender() { return appender(); } } void main() { } ``` The actual error produced is obvious only because the arguments I put on init in this example, but normally it's pretty bizarre: ``` /dlang/dmd/linux/bin64/../../src/phobos/std/array.d(2907): Error: cannot have array of `void(string, int, int)` /dlang/dmd/linux/bin64/../../src/phobos/std/array.d(2976): Error: cannot have array of `inout void(string, int, int)` /dlang/dmd/linux/bin64/../../src/phobos/std/array.d(3369): Error: template instance `std.array.Appender!(S1[])` error instantiating /dlang/dmd/linux/bin64/../../src/phobos/std/array.d(3879):instantiated from here: `RefAppender!(S1[])` onlineapp.d(12):instantiated from here: `appender!(S1[]*, S1)` /dlang/dmd/linux/bin64/../../src/phobos/std/array.d(3429): Error: cannot have array of `inout void(string, int, int)` ``` --
[Issue 7066] You can redefine .init and .stringof without error
https://issues.dlang.org/show_bug.cgi?id=7066 --- Comment #8 from Sobirari Muhomori--- (In reply to timon.gehr from comment #6) > It would be better to have a specific feature here though. E.g. > > struct S{ @disable init; } struct S{ @disable void init(); } ? --
[Issue 7066] You can redefine .init and .stringof without error
https://issues.dlang.org/show_bug.cgi?id=7066 Sobirari Muhomorichanged: What|Removed |Added See Also||https://issues.dlang.org/sh ||ow_bug.cgi?id=14237 --
[Issue 7066] You can redefine .init and .stringof without error
https://issues.dlang.org/show_bug.cgi?id=7066 --- Comment #7 from Jonathan M Davis--- (In reply to timon.gehr from comment #6) > (In reply to Walter Bright from comment #1) > > They're actually supposed to be overridable at the moment. I had thought > > there might be a use for this, but so far none have materialized. > > ... > > There is one obvious use case: > > struct S{ @disable enum init=0; } > > It would be better to have a specific feature here though. E.g. > > struct S{ @disable init; } I would have thought that struct S{ @disable this(); } would do that in addition to making S s; illegal. I was surprised to find out that it didn't. But if there _is_ a good reason for S s = S.init; to still work with @disable this(); was used (though I certainly can't think of one), then @disable init; should probably imply @disable this();. --
[Issue 7066] You can redefine .init and .stringof without error
https://issues.dlang.org/show_bug.cgi?id=7066 timon.g...@gmx.ch changed: What|Removed |Added CC||timon.g...@gmx.ch --- Comment #6 from timon.g...@gmx.ch --- (In reply to Walter Bright from comment #1) > They're actually supposed to be overridable at the moment. I had thought > there might be a use for this, but so far none have materialized. > ... There is one obvious use case: struct S{ @disable enum init=0; } It would be better to have a specific feature here though. E.g. struct S{ @disable init; } --
[Issue 7066] You can redefine .init and .stringof without error
https://issues.dlang.org/show_bug.cgi?id=7066 davi...@fb.com changed: What|Removed |Added CC||davi...@fb.com --- Comment #4 from davi...@fb.com --- *** Issue 13202 has been marked as a duplicate of this issue. *** --
[Issue 7066] You can redefine .init and .stringof without error
https://issues.dlang.org/show_bug.cgi?id=7066 --- Comment #5 from davi...@fb.com --- I would like to see this disable or if we don't want to break backwards compatibility for this, we should have the compiler issue a warning. As it stands at the moment, the behavior causes more harm then good. --
[Issue 7066] You can redefine .init and .stringof without error
https://issues.dlang.org/show_bug.cgi?id=7066 Andrej Mitrovic andrej.mitrov...@gmail.com changed: What|Removed |Added See Also||https://issues.dlang.org/sh ||ow_bug.cgi?id=12545 --
[Issue 7066] You can redefine .init and .stringof without error
https://issues.dlang.org/show_bug.cgi?id=7066 Andrej Mitrovic andrej.mitrov...@gmail.com changed: What|Removed |Added CC||andrej.mitrov...@gmail.com Blocks||12545 --
[Issue 7066] You can redefine .init and .stringof without error
https://issues.dlang.org/show_bug.cgi?id=7066 Andrej Mitrovic andrej.mitrov...@gmail.com changed: What|Removed |Added See Also||https://issues.dlang.org/sh ||ow_bug.cgi?id=12233 Blocks||12233 --
[Issue 7066] You can redefine .init and .stringof without error
https://issues.dlang.org/show_bug.cgi?id=7066 Andrej Mitrovic andrej.mitrov...@gmail.com changed: What|Removed |Added CC||jmdavisp...@gmx.com --- Comment #3 from Andrej Mitrovic andrej.mitrov...@gmail.com --- *** Issue 8817 has been marked as a duplicate of this issue. *** --
[Issue 7066] You can redefine .init and .stringof without error
https://d.puremagic.com/issues/show_bug.cgi?id=7066 Jesse Phillips jesse.k.phillip...@gmail.com changed: What|Removed |Added CC||jesse.k.phillip...@gmail.co ||m --- Comment #2 from Jesse Phillips jesse.k.phillip...@gmail.com 2014-02-24 22:00:11 PST --- How about it is disable until a compelling argument is provided. Or if someone complains during a beta. -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 7066] You can redefine .init and .stringof without error
http://d.puremagic.com/issues/show_bug.cgi?id=7066 Walter Bright bugzi...@digitalmars.com changed: What|Removed |Added Keywords||spec CC||bugzi...@digitalmars.com Severity|normal |enhancement --- Comment #1 from Walter Bright bugzi...@digitalmars.com 2012-01-21 01:11:11 PST --- They're actually supposed to be overridable at the moment. I had thought there might be a use for this, but so far none have materialized. But to change it is an enhancement request. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---