Replies: 1 comment 2 replies
-
It's a feature, not bug 😎 |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
奇怪的语法
为什么Zig要采用这种看起来十分奇怪的包导入语法?
Zig的设计
深入研究了我发现,Zig的文件就是一个
struct
,所以,以下代码在Zig中是合法的这段代码为当前文件所代表的
struct
定义了一个名为hello
的字段,并成功地实例化了自己。这就说的通了,包导入不是在导包,而是在定义一个类型,可以近似理解成:
所以
Zig并不存在实质上的包导入语法,而是创造了一个由外部文件定义的类型
Beta Was this translation helpful? Give feedback.
All reactions