Tuple mixins
Bill Baxter
dnewsgroup at billbaxter.com
Fri May 11 06:34:41 PDT 2007
Daniel Keep wrote:
>
>
> This is one thing I've never especially liked about C, C++ and now D. I
> personally thing that the comma should be used to construct tuples like
> it is in Python, which is a hell of a lot more useful. Plus, this
> behaviour is really friggin' weird :P
>
Amen to that brutha.
It's main use in C and C++ is hackish macro tricks. In C++ it also
finds use as an overloadable operator you can use to confuse the heck
out of people.
Are there any good uses for it? Maybe the lists of initializers in for
loops are using that rule? like -- for(x=3,y=10; x<y; x++) { ... }.
Seems like you could make that part of the for loop grammar instead of a
really useless works anywhere rule. Besides if it worked as a tuple
maker, and multiple assigment worked then you could do
for (x,y=3,10; x<y; x++) { . . . }
Definitely seems like a waste.
--bb
More information about the Digitalmars-d-learn
mailing list