Bug? somearrayofclassinstances.filter(...).array fails because of .init() method in class

Steven Schveighoffer via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Jul 18 15:03:21 PDT 2016


On 7/15/16 7:44 AM, ag0aep6g wrote:
> 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 methods
>
> Known 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.

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.

-Steve


More information about the Digitalmars-d-learn mailing list