On type functions vs T...

Paul Backus snarwin at gmail.com
Wed May 6 02:02:00 UTC 2020


On Tuesday, 5 May 2020 at 19:34:02 UTC, H. S. Teoh wrote:
> Couldn't agree more!  Templates are supposed to be used for 
> parametrization over types (and other compile-time values), but 
> they're not intended for actual *computation*.  Just because 
> they happened to be Turing-complete (which is something the C++ 
> people discovered after the fact -- it wasn't designed to be 
> that way), doesn't mean they should actually be used for 
> computations.
[...]
> Compile-time computation should be done by a proper tool for 
> the job: CTFE, in D's case.

The most appropriate tool here would be Lisp-style macros. But 
given Walter's opinion on "the M word", type functions are 
probably the closest thing we're likely to get.


More information about the Digitalmars-d mailing list