Struct Initialization syntax

aliak something at something.com
Mon Jul 23 17:59:21 UTC 2018


On Monday, 23 July 2018 at 17:46:12 UTC, H. S. Teoh wrote:
> I worded myself poorly.  What I meant was that if a ctor 
> parameter has the same name as a field, then it's obviously 
> meant to initialize that field, so there isn't really a 
> conflict, you're just passing the argument to the ctor instead 
> of setting it directly to the struct.  It would be a 
> horrendously bad idea to have a ctor parameter that has the 
> same name as a field, but is used to initialize a different 
> field.
> [...]
>> 
>> If named arguments choose a different syntax then you have no 
>> conflict. If they go with the same (i.e. option 2) then you 
>> have seamless consistency.
> [...]
>
> Yes, this is what I was trying to get at.  Thanks!
>
>
> T

Hehe oops, indeed you were :p Seems I did not parse properly. 
Apologies!

Cheers,
- Ali



More information about the Digitalmars-d mailing list