I dun a DIP, possibly the best DIP ever

Steven Schveighoffer schveiguy at gmail.com
Fri Apr 24 12:37:22 UTC 2020


On 4/24/20 8:08 AM, Steven Schveighoffer wrote:
> On 4/24/20 12:22 AM, Walter Bright wrote:
>> On 4/22/2020 6:18 AM, Steven Schveighoffer wrote:
>>> int double_int(int val) { return 2 * val; }
>>>
>>> T double_int(T val) { return val; }
>>>
>>> void double_ints(alias pred, T... args) {
>>>     pred(double_int(args)...);
>>> }
>>
>> This can be done with the array syntax proposal using UFCS:
>>
>> void double_ints(alias pred, T... args) {
>>      args.pred();
>> }
> 
> What's the array syntax proposal? The above seems not to invoke 
> double_int at all.

OK, I now see there's a huge giant thread about this later ;)

so I think you mean this:

double_int(args).pred;

Which.... I don't know if this is what we want to support as a tuple 
expansion automatically (vs. compiler error)

-Steve


More information about the Digitalmars-d mailing list