top | item 33104208

(no title)

SighMagi | 3 years ago

Lisp user here, I couldn’t quiet tell from all the Zig syntax, but is “comptime” here like having the whole language available to you to do whatever you like at at compile time like in Common Lisp?

discuss

order

TUSF|3 years ago

I've never used lisp, but I'm pretty sure you have the right idea. The only limitation is that it can only act on data that is compile-time known, which is a defined concept in Zig.

At the moment you can't do comptime allocations, so everything has to exist on the stack, but you can, for example, embed a file like a config or dataset, and run it thru a parser to turn it into some data structure, which is something you might otherwise work into the build system, running python/perl scripts to generate temporary code files, but now you can cut out the extra dependency by having that code generation in the same language.