3 ms·
> comptime doesn't allow you to create domain specific macros Sure it does! Zig's string format function is written using comptime. It parses the format stri
by Laremere 3y ago
> comptime doesn't allow you to create domain specific macros
Sure it does!
Zig's string format function is written using comptime. It parses the format string and validates the arguments at compile time. See https://github.com/ziglang/zig/blob/master/lib/std/fmt.zig https://github.com/ziglang/zig/blob/master/lib/std/fmt.zig
I also toyed around with turning a math equation dsl into compiled statements at https://github.com/Laremere/alg https://github.com/Laremere/alg I got matrix math working so, eg, if you multiply a 2by1 matrix by a 1by2 matrix, it returns a matrix which is typed to 2x2.