How does Circle's CTFE compare to D?

Ola Fosheim Grøstad ola.fosheim.grostad at
Sat Dec 4 15:44:07 UTC 2021

On Saturday, 4 December 2021 at 13:53:27 UTC, Johannes Riecken 
> Interesting point. Do you have an example for that? Going top 
> to bottom seems like a good choice.

Depends on what you want to do. If the compilation of one 
source-file creates a file that another source-file wants to 
read, how do you know what the order should be? A key point of 
C++ is that you can have concurrent builds.

> For functions without side effects that interface specification 
> would be equivalent to adding something like `static assert 
> f(3) == 9` to a compile-time function f in D?

In D you can test if a function is executed on compile time, but 
in C++ it is part of the function type (signature).

The key difference is that in C++ the compiler checks that a 
compile-time function is limited to a reasonable subset when it 
is defined even if it isn't used. Which is useful for library 
authors. Within an application there is no practical difference, 

> My understanding from the talk is that Circle can compile C++, 
> too, so if Sean Baxter adds a few well-specified and easily 
> understandable features in a bug-free way, then I don't see the 
> lack of traction being a major issue.

It is a C++-family compiler, so you are right, it could pick up 
some interest for that reason alone! I guess some would use it if 
it was open source. I personally wouldn't as C++ does not need 
more complexity and features that does not match the rest of the 
language. (What was Sutter thinking when he came up with the 
syntax for "inspect"/"is"/"as"?)

This is something D needs to take advantage of. KISS! (Keep It 
Simple Stupid ;^)

More information about the Digitalmars-d mailing list