It seems pure ain't so pure after all

Tommi tommitissari at hotmail.com
Sun Sep 30 23:25:39 PDT 2012


On Monday, 1 October 2012 at 06:18:48 UTC, Jonathan M Davis wrote:
>
> A function which uses __ctfe should probably do essentially the 
> same thing at
> both runtime and compile time, but it _has_ __ctfe, because the 
> runtime
> implementation won't work at compile time, and it's up to the 
> programmer to
> make sure that the function does what it's supposed to at both 
> compile time
> and runtime. The compiler can't possibly enforce that.

Thus we're in a situation where pure means pure only by 
convention, not because it's enforced by the compiler. It's like 
const in c++ then, it's const only by convention, only because 
people promise that they're not going to mutate it. I don't like 
rules that are enforced only by everybody relying on good manners.



More information about the Digitalmars-d mailing list