<br><br><div class="gmail_quote">On Fri, Jan 1, 2010 at 09:12, bearophile <span dir="ltr">&lt;<a href="mailto:bearophileHUGS@lycos.com">bearophileHUGS@lycos.com</a>&gt;</span> wrote:<br><div> </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
What are the parts of the D1/D2 languages that are both common enough in programs and not easy to remember, so you need to look them often in the docs (or in an example list, code snippets list, already written code, etc)? This list is partially subjective, but probably there are also some common trends.<br>
</blockquote><div><br>- variadic functions. I can&#39;t for the life of me remember if it&#39;s <br>foo(...) <br>foo(a...)<br>foo(a, ...)<br>and I always forget there is also foo(int[] a ...). Quick, what&#39;s the difference with foo(int[] a) ?<br>
And when I look at them in the docs, I&#39;m, like &quot;OMG, *void!&quot;.<br>So I end up writing foo(T...)(T args) and all is for the best: I got the types, I got the length, I can static-if-act on them, I can put guards and I can even recurse on them!<br>
<br>void foo(T...)(T args)<br>{<br>    writeln(args);<br>    static if (T.length)<br>        foo(args[1..$]);<br>}<br><br>- mixin. I have template Foo(T, U). In my code, should I write:<br>Foo!(int, double);<br>mixin Foo!(int, double);<br>
mixin( Foo!(int, double));<br><br>When I discovered D some time ago, that was something that stalled me :(<br><br><br>Philippe<br></div></div>