CTFE Status

ketmar via Digitalmars-d digitalmars-d at puremagic.com
Fri Nov 4 20:01:48 PDT 2016


On Friday, 4 November 2016 at 10:59:25 UTC, Marc Schütz wrote:
> In this case better make sure to remove the resulting dead code 
> from the old interpreter, otherwise it will become and 
> unmaintainable mess in the long run.

interpreter is used all over the code, and it is a set of 
visitors doing various things. that is, it is not possible to 
remove "dead code" from it, only replace it as a whole. which is 
a great achievement, but completely unpractical. it is way, way 
easier to build the basic VM that runs alongside the old 
interpreter, and call old one if new VM found something it can't 
process yet. this way new VM can be used to speed up some parts, 
but nothing will be broken, and VM can be refined gradually. 
also, it is great for testing: one can call new and old 
interpreters and compare results. as new VM is completely 
independent of old interpreter, the code won't be any messier 
than it is now. ;-)

from a technical POV CTFE interpreter is just a codegen: it 
receiving lowered AST, visit nodes and does some actions. one can 
have many codegens in frontend code, they won't hurt each other. 
;-)


More information about the Digitalmars-d mailing list