Variadic grouping
JS
js.mdnq at gmail.com
Mon Jul 29 10:35:07 PDT 2013
On Monday, 29 July 2013 at 17:28:57 UTC, Meta wrote:
> On Monday, 29 July 2013 at 17:22:50 UTC, JS wrote:
>> I'm not sure how named parameters would solve the original
>> problem
>
> Your original use case:
>
> template t(T1..., T2...)
>
> ...
>
> t!(a, b, c; d, e, f);
>
> Becomes
>
> //Some weird hypothetical syntax
> template t(@name("T1") T1..., @name("T2") T2...)
> {
> ...
> }
>
> t!(T1 = a, b, c, T2 = d, e, f);
>
>> but using a syntax like what I'm suggesting one can do stuff
>> like
>>
>> ...
>
> I think these use cases would all work with named parameters.
I don't think that is very robust notation but if it is then it
would work.
Using ';' makes it obvious the next group is starting. In your
notation, it seems like there could be issues. What if T2 is a
local variable, then is that an assignment? If there is no
possible issues then I wouldn't mind having such a syntax...
anything is better than nothing.
More information about the Digitalmars-d
mailing list