foo => "bar" key/value literals in D!

Andrei Alexandrescu via Digitalmars-d-announce digitalmars-d-announce at puremagic.com
Sat Jun 11 02:07:43 PDT 2016


On 6/11/16 3:57 AM, Vladimir Panteleev wrote:
> On Tuesday, 31 May 2016 at 06:21:03 UTC, Andrei Alexandrescu wrote:
>> On 5/27/16 10:17 PM, Taylor Hillegeist wrote:
>>> On Friday, 27 May 2016 at 18:10:59 UTC, Vladimir Panteleev wrote:
>>>> On Monday, 23 May 2016 at 19:00:40 UTC, Adam D. Ruppe wrote:
>>>>> Have I gone completely mad?!?!
>>>>
>>>> Yes, though what does it have to do with this thread? :D
>>>>
>>>> This is by far the most appealing way to implement named arguments
>>>> that I've seen so far:
>>>>
>>>> https://github.com/CyberShadow/ae/blob/master/utils/meta/args.d
>>>
>>> This is very nice... way more clean than I imagined possible.
>>
>> s/args/make/g and we have a nice function for std.conv. -- Andrei
>
> Do I gather from that that you propose adding only the overload that
> creates structs?

No, both are nice to have. If one name is needed for both, "args" is 
indeed a good commonality. "Invoke function f with these args" and 
"Construct an object of type T with these args". The problem is it's not 
very intuitive in usage.

Perhaps "call" for functions and "make" for objects are better. If we 
add these to std.experimental.functional and std.experimental.conv and 
they get a lot of usage we might make a small change to the language.


Andrei



More information about the Digitalmars-d-announce mailing list