Silicon Valley D Meetup - April 15, 2021 - "Compile Time Function Execution (CTFE)"
sighoya
sighoya at gmail.com
Mon Apr 26 14:01:37 UTC 2021
On Monday, 26 April 2021 at 13:17:49 UTC, FeepingCreature wrote:
> On Sunday, 25 April 2021 at 21:27:55 UTC, sighoya wrote:
>> On Monday, 19 April 2021 at 06:37:03 UTC, FeepingCreature
>> wrote:
>>> Native CTFE and macros are a beautiful thing though.
>>
>> What did you mean with native?
>
> When cx needs to execute a function at compiletime, it links it
> into a shared object and loads it back with dlsym/dlopen. So
> while you get a slower startup speed (until the cache is
> filled), any further calls to a ctfe function run at native
> performance.
Ah okay, but can't Dlang runtime functions not anyway called at
compile time with native performance too?
So generally, cx first parses the program, then filters out what
is a macro, then compiles all macro/ctfe functions into shared
lib and execute these macros from that lib?
Isn't it better to use the cx compiler as a service at compile
time and compile code in-memory in the executable segment (some
kind of jiting I think) in order to execute it then.
I think the cling repl does it like that.
And how does cx pass type objects?
More information about the Digitalmars-d-announce
mailing list