How does Circle's CTFE compare to D?

Ola Fosheim Grøstad ola.fosheim.grostad at gmail.com
Sat Dec 4 09:49:39 UTC 2021


On Saturday, 4 December 2021 at 08:43:14 UTC, Johannes Riecken 
wrote:
> I've watched [Don't constexpr all the 
> things](https://www.youtube.com/watch?v=NNU6cbG96M4), which is 
> a talk explaining how [Cirlce](https://www.circle-lang.org/) 
> does meta-programming and I found it very interesting that it 
> looks as simple as I as a newbie would imagine meta-programming 
> should be, i.e. it can execute any C++ function or library 
> function at compile time.

Circle is primarily interesting because it pushes the boundaries 
for C++, but does it allow the execution of any C++ function? I/O 
can make things very complicated as you either have to impose a 
specific compilation order or use some other ordering or 
constraining principle to avoid dependency issues or feedback 
loops. This in turns makes it impossible to accept the execution 
of any C++ function!

D's CTFE is somewhat more flexible than C++ constexpr, but C++ 
constexpr/consteval also works as an interface specification, 
meaning: if a function in a library is marked as compile time 
then you can rely on it for the future and across platforms.

The question is, what kind of language do you want? A language 
for writing small short lived self-contained programs that makes 
programming frictionless, or a language for writing larger long 
lived portable programs that depends on third party code bases 
that receive upgrades over time?

There are many really cute languages for writing small short 
lived self-contained programs, but they rarely get traction. 
(There are counter examples: PhP, Perl, …)





More information about the Digitalmars-d mailing list