The daily D riddle

Seb seb at wilzba.ch
Sun Jan 28 11:47:28 UTC 2018


On Sunday, 28 January 2018 at 11:41:44 UTC, Daniel Kozak wrote:
> https://run.dlang.io/is/gVL0g7
>
> On Sun, Jan 28, 2018 at 12:23 PM, Seb via Digitalmars-d < 
> digitalmars-d at puremagic.com> wrote:
>
>> On Sunday, 28 January 2018 at 06:44:28 UTC, Timothee Cour 
>> wrote:
>>
>>> why is `a.init` even legal? (instead of typeof(a).init)
>>> likewise the following compiles, but IMO should not:
>>> class A{ void fun(this a){}}
>>> (instead we should have typeof(this)
>>>
>>> How about deprecating these lax syntaxes?
>>> they serve no purpose (we should use typeof(...)) and can 
>>> cause harm
>>> in generic code
>>>
>>
>> Yes, good idea!


But `typeof(a).init` would have the same behavior here: 
https://run.dlang.io/is/jvG2hW


More information about the Digitalmars-d mailing list