digitalmars.D.learn - Bug? somearrayofclassinstances.filter(...).array fails because of
- dom (17/17) Jul 15 2016 i just had a scenario like the one below. when calling .array on
- ag0aep6g (7/13) Jul 15 2016 Known issue.
- Steven Schveighoffer (7/21) Jul 18 2016 This is being worked on.
i just had a scenario like the one below. when calling .array on the filterresult dmd goes nuts because of the init() function in Players. Renaming to initialize() solved the problem. Solution: As .init is used for struct initialization and such (https://dlang.org/spec/property.html#init) i think it should be a restricted keyword for class members and methods experienced programmers ofc know that .init is used in special ways and avoid it. newcomers like me have a hard time with such cases. class Players { void init() { ... } ... } auto candidates = players.filter!(x => { return x.active && x.getName().indexOf(searchstring) > -1; }).array;
Jul 15 2016
On 07/15/2016 12:54 PM, dom wrote:i just had a scenario like the one below. when calling .array on the filterresult dmd goes nuts because of the init() function in Players. Renaming to initialize() solved the problem. Solution: As .init is used for struct initialization and such (https://dlang.org/spec/property.html#init) i think it should be a restricted keyword for class members and methodsKnown issue. https://issues.dlang.org/show_bug.cgi?id=14237 https://issues.dlang.org/show_bug.cgi?id=7066 Of course, being known doesn't mean that anyone is actively working on a fix. Feel free to make (a little) noise on Bugzilla, or in the General group.
Jul 15 2016
On 7/15/16 7:44 AM, ag0aep6g wrote:On 07/15/2016 12:54 PM, dom wrote:This is being worked on. The issue is that TypeInfo.init is used by druntime to mean the init data to store for a type. So until that has been deprecated for a long enough time (I don't know the current status, but we are in the process of naming it initializer instead), then we can't fix this issue. -Stevei just had a scenario like the one below. when calling .array on the filterresult dmd goes nuts because of the init() function in Players. Renaming to initialize() solved the problem. Solution: As .init is used for struct initialization and such (https://dlang.org/spec/property.html#init) i think it should be a restricted keyword for class members and methodsKnown issue. https://issues.dlang.org/show_bug.cgi?id=14237 https://issues.dlang.org/show_bug.cgi?id=7066 Of course, being known doesn't mean that anyone is actively working on a fix. Feel free to make (a little) noise on Bugzilla, or in the General group.
Jul 18 2016