On Friday, 6 May 2022 at 05:58:37 UTC, Siarhei Siamashka wrote:
> On Thursday, 5 May 2022 at 23:06:26 UTC, Walter Bright wrote:
> It was D that changed that perception. Suddenly, native languages started implementing CTFE.
Is CTFE really that useful? Generating code as a part of the build process has been in use since a very long time ago. Any programming languages (perl, python, php, ...) or tools (bison, flex, re2c, ...) could be used for this. Yes, the build process becomes a bit more complicated, because you suddenly have more build dependencies and more complicated build scripts or makefiles. Still it's not a rocket science. Everything is pretty easy to use and understand.
That's the point. It reduces build complexity in a disruptive way.
> CTFE allows to to cut some corners and move this complexity into a compiler. The upside is that we don't need advanced build scripts. But the downside is potentially slower compilation (especially with the interpreting approach), which is also too obscure and hard to notice and fix.
You have to include your build tool invocation and development time
> Additionally, can CTFE be used to sniff some passwords from my system and embed them into a compiled binary? Now we got some security concerns on top of that.
We are now deep in "whataboutism-fallacy" territory here, aka as clutching at straws to win he last word in a debate. The same security issue (I would even say, worse) with external build tools generating code.
> As for the other languages implementing CTFE, my understanding is that compiler people just generally have to do something to keep the ball rolling and have themselves entertained and employed ;-) The features themselves may be useful or they may be just gimmicks. Only time will tell.
At the end of the day, D language happens to be unpopular. CTFE doesn't look like a panacea.
No-one ever said it was (this is another rhetorical fallacy called strawman).