On Tue, Sep 14, 2010 at 17:01, Andrei Alexandrescu &lt;<a href="mailto:SeeWebsiteForEmail@erdani.org">SeeWebsiteForEmail@erdani.org</a>&gt; wrote:<br>&gt;<br>&gt;  I think we&#39;ll move forward with that one. I&#39;ll start working on the content. Ideas for good tutorial examples?<br>
&gt;<br><br>Maybe more examples of what&#39;s interesting me right now than tutorials, but who knows?<br><br>* executing command-lines instructions from a D program. Theme: file I/O, OS interaction.<br>An interesting example is having a script that loads a D file, modifies its source, asks for DMD to compile it and then runs it and get its result. It could be the first brick to get a REPL / idmd (interactive dmd). Maybe more a [challenge] subject than a tutorial example?<br>
<br>* fun with types and operator overload:<br><br>auto g = gobble ~1 ~ &quot;a&quot; ~ 2.34 ~ (int i) { return i*i;} ~ [1,2,3];<br><br>struct Gobbler(T...) is just a tuple-like type overloading opBinary!(&quot;~&quot;, U)(U u) to return Gobbler!(T, U)(this.payload, u). gobble() is just a helper function returning Gobbler!()<br>
The type is evolving along with the expression consumption. I find this fascinating. Statically typed variadic expressions: how many language offer this? How many lines of C++?<br>Now, if only alias this worked for typetuples, we could even do g[3] to get the function literal back.<br>
<br>* related to this: expressions templates in D.<br>cpp-next has a nice article introducing Boost.Proto and such.<br><a href="http://cpp-next.com/archive/2010/08/expressive-c-introduction/">http://cpp-next.com/archive/2010/08/expressive-c-introduction/</a><br>
I&#39;m reading the Boost.Proto docs right now and find them quite interesting.<br><br>Variable!double _1, _2;<br>auto expr = (_1 + _2)*_1 + 1; // expr encodes the entire expression in its type and is a callable struct.<br>
In D, it could be a BinOp!(&quot;+&quot;, BinOp!(&quot;*&quot;, BinOp!(&quot;+&quot;, Variable!double,Variable!double),Variable!double),int)<br><br>* a small script that find ddocs comments from D code and find any 
fri****g missing parenthesis, telling the user were in the file she 
should look (and range of line spanning the comment). Finding ddocs 
comments and counting open/closed parenthesis is a simple example of 
parsing/finite state automata.<br><br>* some interesting examples of templates or string mixins could help alleviate the sentiment they are unknowable black magic. I admit it, I have no interesting/new example in mind right now. Some example where a custom struct is created according to CT parameters could be interesting.<br>
<br><br>Philippe<br><br>