Variadic grouping
Artur Skawina
art.08.09 at gmail.com
Sun Aug 11 05:57:44 PDT 2013
On 08/11/13 04:07, JS wrote:
> On Saturday, 10 August 2013 at 18:28:39 UTC, Artur Skawina wrote:
>> A!(int, 0, float, Group!(ubyte, "m", float[2], Group!(Group!(int,11,12), Group!(float,21,22)))) x4;
>>
>> Using just ';' would: a) be too subtle and confusing; b) not be enough
>> to handle the 'x4' case above.
>
> a) thats your opinion.
I can't think of a more subtle way to separate lists than using just
a single pixel. I know -- I should try harder.
> b) wrong. Using Group is just an monstrous abuse of syntax. It's not needed. I don't think there is a great need for nested groupings, but if so it is easy to make ';' work.
>
> Do your really think
>
> that Group!() is any different than `;` as far as logic goes?
Yes.
> If so then you really need to learn to think abstractly.
Won't help in this case.
> This is like saying that there is a difference between using () or {} as groupings. There is no semantic difference except what you choose to put on it. Hell we could use ab for grouping symbols.
>
> Group!() and (); are the same except one is shorter and IMO more convienent... there is otherwise, no other difference.
Wasn't ';' enough?
> to see this, x4 can be written as
>
> A!(int, 0, float, (ubyte, "m", float[2], ((int,11,12), (float,21,22)))) x4;
>
> Note, all I did was delete Group!. IT IS HAS THE EXACT SAME LOGICAL INTERPRETATION.
[...]
> Just because you add some symbol in front of brackets does not magically make anything you do different... just extra typing.
>
>> A!(int, 0, float, #(ubyte, "m", float[2], #(#(int,11,12), #(float,21,22)))) x4;
>
> But there should be no need for # as there is no need for Group. (again, I'm not talking about what D can do but what D should do)
template A(T...) { pragma(msg, T); }
alias B = A!("one", (2.0, "three"));
artur
More information about the Digitalmars-d
mailing list