Flag proposal

Walter Bright newshound2 at digitalmars.com
Sat Jun 11 20:05:11 PDT 2011


On 6/11/2011 12:58 PM, Andrei Alexandrescu wrote:
> On 6/11/11 1:59 PM, Michel Fortin wrote:
>> On 2011-06-11 13:08:48 -0400, Andrei Alexandrescu
>> <SeeWebsiteForEmail at erdani.org> said:
>>
>>> With named parameters, we'd have something along the lines of:
>>>
>>> topNIndex(a, sortOutput : true);
>>>
>>> which is nice, but not present in the language (and I can tell after
>>> talking to Walter it won't be anytime soon).
>>
>> The funny thing is that named arguments are not that difficult to
>> implement as long as you don't allow reordering. Much easier than
>> const(Object)ref actually.
>>
>> <https://github.com/michelf/dmd/commit/673bae4982ff18a3d216bc1578f50d40f4d26d7a>
>>
>>
>> Took
>> me less time than what I took arguing about Flag!"".
>
> Love the attitude!! Let's see what Don and Walter think.

I think it's clever and insightful how Michel's solution is implemented. It does 
not allow, however, for named arguments to be not in the same positions as 
unnamed ones.

In other words, unlike struct field initializations, named arguments cannot 
appear in any order. I think people will find it an odd difference.



More information about the Digitalmars-d mailing list