原文: https://www.scottredig.com/blog/bonkers_comptime/ 译注:原文中的代码块是交互式,翻译时并没有移植。另外,由于 comptime 本身即是关键概念,并且下文的意思更侧重于 Zig comptime 的特性,故下文大多使用 comptime 代替编译时概念。 引子 编程通过自动化地处理数据极大地提升了生产力。而元编程则让我们可以像处理数据一样处理代码,以此将编程的力量反向作用于编程自身。而在...| Zig 语言中文社区
Zig's Comptime is Bonkers Good| www.scottredig.com
This is part of a series on Zig comptime usecases.| Mitchell Hashimoto
Zig has a very powerful feature called comptime.| Mitchell Hashimoto
zoop 是什么 zoop 是 zig 的一个 OOP 解决方案,详细信息可以看看 zoop官网。 为什么不用别的 OOP 语言 简单的说,是我个人原因,必需使用 zig 的同时,还一定要用 OOP,所以有了 zoop。 zoop 入门 类和方法 1 2 3 4 pub const Base = struct { pub usingnamespace zoop.Fn(@This()); mixin: zoop.Mixin(@This()), } 2-3行是一个struct成为zoop类必需的两行,这样一来,Base 就成为了一个 zoop 的类。 创建 Base 的对象有两...| Zig 语言中文社区
Zig’s reflection combined with Zig’s ability to import C header files means Zig can be used for C macro reflection.| jstrieb.github.io
What can Zig learn from TypeScript, and what can TypeScript learn from Zig?| effectivetypescript.com