How far can CTFE go?

H. S. Teoh hsteoh at quickfur.ath.cx
Thu Feb 2 17:18:42 PST 2012


On Fri, Feb 03, 2012 at 12:51:51AM +0000, Manfred Nowak wrote:
> H. S. Teoh wrote:
> 
> > the ideal situation would be that CTFE can replace writing an
> > arbitrarily complex helper program
> 
> Aebitrary complex helper programs may include viruses and other nice 
> surprises. Walter does not want that adminstrators have to worry about 
> a compilation step to torture the system in such a way.
[...]

Well, random source code you downloaded over the internet may contain
trojans with embedded viruses, so I don't think CTFE would make this
problem any worse. You *are* running the virus either way, whether it's
compiling the helper programs first and running them (e.g., by running
the makefile or build script), or having the compiler run the virus via
CTFE.

Plus, if you're worried about CTFE being abused to cause problems with
the machine it's being compiled on, the current implementation already
suffers from the halting problem: the compiler cannot tell whether a
CTFE function will ever terminate. It could simply just keep consuming
more and more compiler resources (say, by continually appending to an
array) until memory is exhausted. And we all know the halting problem is
unsolvable. I don't think that should be grounds to get rid of CTFE,
though.


T

-- 
Кто везде - тот нигде.


More information about the Digitalmars-d-learn mailing list