News for hackers. Stuff that matters.
Re:C++17 constexpr everything, or as much as the compiler can by jstimpfle on Thursday December 28, 2017 @04:37PM (#16025096)
I think this might waste resources for some transient results. Sometimes that computation time required for evaluation is negligible, and the result might require more memory than "the function call".
Re:C++17 constexpr everything, or as much as the compiler can by WalterBright on Thursday December 28, 2017 @05:11PM (#16025400)
It's been in D for a decade, and has been extremely successful, to the extent of becoming a critical feature.

An early example was someone wrote a ray tracer in D that ran and generated output completely at compile time.

A more useful example is D's regex package can build the engine at compile time, thereby emitting a custom engine for the regex, instead of at runtime.

Re:C++17 constexpr everything, or as much as the compiler can by barsonme on Friday December 29, 2017 @01:15AM (#16027961)
While I think it's awesome D can do that (and am a bit jealous the languages I use regularly don't have any real sort of constexpr) what does that _really_ provide?

It would seem the startup cost of building a regexp engine would really only matter for, say, command-line programs (i.e., short-lived, run-once programs). For a web application the overhead would be negligible.

Again, don't get me wrong, but it just seems to be more of a "neat!" thing than a "we _need_ this for reasons X, Y, and Z."

Re:C++17 constexpr everything, or as much as the compiler can by WalterBright on Friday December 29, 2017 @01:33AM (#16028027)
Most regex engines build interpreter bytecode at runtime, and then execute the bytecode with an interpreter. Being able to generate the engine at compile time means the runtime engine is running custom compiled code.

So, what it _really_ provides is runtime performance.