most non-function templates could be advantageously replaced by function templates

Steven Schveighoffer schveiguy at yahoo.com
Tue May 14 09:31:24 PDT 2013


On Tue, 14 May 2013 02:56:09 -0400, Timothee Cour  
<thelastmammoth at gmail.com> wrote:

> *Limitations*:
> One typical case where this isn't possible is when a template defines an
> type alias, eg:
> ----
> template Iota(int stop) {
>     static if (stop <= 0)
>         alias Iota=TypeTuple!();
>     else
>         alias Iota=TypeTuple!(Iota!(stop-1), stop-1);
> }
> ----

Another is that CTFE can hit a brick wall and fail to compile.  It's an  
implementation bug, but something to consider before changing everything  
to CTFE.  AFAIK, straight templates don't have this limitation.  There was  
quite a bit of talk at the conference about how CTFE is awesome, but too  
limited based on the current D front end.

Otherwise, I like the idea.  If nothing else, it gives more flexibility.

-Steve


More information about the Digitalmars-d mailing list