DIP 50 - AST macros

deadalnix deadalnix at gmail.com
Sun Nov 17 12:07:36 PST 2013


On Sunday, 17 November 2013 at 19:41:40 UTC, Simen Kjærås wrote:
> On 13.11.2013 20:05, Ellery Newcomer wrote:
>> On Wednesday, 13 November 2013 at 10:51:48 UTC, Simen Kjærås 
>> wrote:
>>> On 12.11.2013 18:53, Ellery Newcomer wrote:
>>>
>>> It's perfectly possible in D to make this work:
>>>
>>
>> hey, cool impl
>>
>> *comprehends code*
>>
>> I mean Ewww
>>
>>> I *can* make that work. I'm not going to.
>>>
>>> --
>>>   Simen
>>
>> I concur with the second part.
>
> I decided to abandon sanity. Luckily, only for the named 
> parameters. I
> now have this code working:
>
>
> void test(int a, int b = 2, string c = "foo", int d = 14) {
> }
>
> alias test2 = nameify!test;
>
> void main() {
>      test2(1, Args.d = 4, Args.c = "bar");
> }
>
> With reasonable error messages for duplicate and missing 
> parameters, as
> well as type mismatches.
>
> Source is attached. I hope God forgives me.

That is a really cool idea !


More information about the Digitalmars-d mailing list