Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> Templates are Turing complete (lazily evaluated, purely functional, and side-effect free), so whatever your language of choice can do can be backported to C++ (granted, painfully, but probably less painfully than throwing out all your legacy code and starting from scratch).

This does not logically follow, since templates are evaluated at compile time and hence have restrictions on what they can do.

> C++ supports zero-cost abstraction, so it will get very close to low level C performance (including constant propagation, loop unrolling, type-unsafe transformations, hoisting, inlining, etc, etc) even if you throw piles of lambdas and encapsulated methods at it.

You do have to be careful with what you're doing, though.

> the compiler is slooooowww

I mean, it's not like the Rust compiler is fast either…



"since templates are evaluated at compile time and hence have restrictions on what they can do"

This statement doesn't make any sense. A Lisp program can be fully converted to run at compile time; it'll just be lacking in I/O opportunities.


You do realize that I/O is two thirds of "input, processing, output": what computers do?

What app do you use that takes no input? Or produces no output? Let alone both?


Any reasonable compiler will time out before you can do anything too fancy at compile time.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: