It seems pure ain't so pure after all
Jonathan M Davis
jmdavisProg at gmx.com
Mon Oct 1 11:36:25 PDT 2012
On Monday, October 01, 2012 19:53:53 Tommi wrote:
> I solemnly swear not to use __ctfe improperly. But my problem
> with it is, that there *exists* the possibility of improper use
> of __ctfe.
I could just as easily name a function pow2 and make it return the square
root. I could overload operator + to do operator -. I could make it so that a
function does one thing on Linux and does something completely different and
unreleated on Windows. There are _tons_ of places in programming where the
programmer has to not be an idiot or their fellow programmers are going to end
up with tons of pain.
__ctfe is no different from static if or version or any feature which makes it
so that the block of code is different on different machines, and it's generally
a whale of a lot less error-prone than stuff like endianness issues. It's even
trivial to use the same unit tests to test that your function does the same
thing in CTFE as at runtime, which you can test on the same machine, unlike
with architecture and OS differences.
I really think that you're blowing this way out of proportion. Certainly,
you think that there's a problem here when the rest of us don't.
- Jonathan M Davis
More information about the Digitalmars-d
mailing list