Skip to content

Instantly share code, notes, and snippets.

@jiacai2050
Last active August 14, 2023 00:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jiacai2050/a6337dfa9d6ea1f7a34943837e9aa42e to your computer and use it in GitHub Desktop.
Save jiacai2050/a6337dfa9d6ea1f7a34943837e9aa42e to your computer and use it in GitHub Desktop.
1
00:00:00,000 --> 00:00:06,800
大家好,今天是2021年6月27号,是InMessTalk的第一期。
2
00:00:06,800 --> 00:00:11,700
这一期主要由我来讲一下这个节目的背景。
3
00:00:11,700 --> 00:00:17,200
在介绍背景之前,首先进行一下主播的个人介绍。
4
00:00:17,200 --> 00:00:25,100
我是14年大学毕业,现在是在杭州的一家互联网公司工作。
5
00:00:25,300 --> 00:00:31,300
我之前用过的语言也比较多,Java,Python,Curl都用过。
6
00:00:31,300 --> 00:00:34,400
现在主要是用Go和Rust。
7
00:00:34,400 --> 00:00:39,900
我接触Emacs的原因最早是由于SRCP。
8
00:00:39,900 --> 00:00:44,700
由于SRCP是用Scheme来作为讲解,
9
00:00:44,700 --> 00:00:49,400
而Scheme作为一门Lisp方言,
10
00:00:49,400 --> 00:00:52,400
用Emacs来编辑是。
11
00:00:52,470 --> 00:00:53,710
再恰当不过的了
12
00:00:53,710 --> 00:00:58,590
但是由于emacs的上手难度比较高
13
00:00:58,590 --> 00:01:01,550
我前前后后折腾了好多次
14
00:01:01,550 --> 00:01:06,510
大概是在16年才正式把emacs真正用了起来
15
00:01:06,510 --> 00:01:10,950
到现在算起来的话大概有五六年的样子
16
00:01:10,950 --> 00:01:15,390
我最早使用的配置是一个clurl的
17
00:01:15,390 --> 00:01:19,310
名字大概是叫emacs-for-clurl
18
00:01:19,670 --> 00:01:24,670
在那基础之上我陆陆续续加了很多自己的配置
19
00:01:24,670 --> 00:01:28,790
现在我的配置相当于把它已经抛弃了
20
00:01:28,790 --> 00:01:31,750
完全是自己来做管理
21
00:01:31,750 --> 00:01:38,390
我现在主要是用user package来进行包的安装与配置
22
00:01:38,390 --> 00:01:41,510
对于一些比较重要的包
23
00:01:41,510 --> 00:01:44,110
比如说像magate, evo
24
00:01:44,950 --> 00:01:46,890
submodule把它管理起来,
25
00:01:46,890 --> 00:01:51,190
防止由于升级导致软件的一些崩溃。
26
00:01:51,190 --> 00:01:57,190
除此之外,我主要是用在evol下使用emacs,
27
00:01:57,190 --> 00:02:02,510
由于在使用emacs大概在两到三年以后,
28
00:02:02,510 --> 00:02:05,110
我的小指隐隐作痛,
29
00:02:05,110 --> 00:02:09,150
后来把大小写件改成control,
30
00:02:09,150 --> 00:02:11,230
情况有所缓解,
31
00:02:11,230 --> 00:02:14,190
但是也不能根本上解决问题。
32
00:02:14,590 --> 00:02:17,070
然后大概在一年多以前,
33
00:02:17,070 --> 00:02:22,430
我把我的所有按键放到了evol之上,
34
00:02:22,430 --> 00:02:25,870
现在我的小指基本上已经彻底解放了。
35
00:02:25,870 --> 00:02:29,750
除了这两个最重要的以外,
36
00:02:29,750 --> 00:02:35,790
其他的package还有像company用来做代码的补全,
37
00:02:35,790 --> 00:02:37,430
然后是listview。
38
00:02:37,430 --> 00:02:40,430
用来做代码的跳转
39
00:02:40,430 --> 00:02:46,030
基本上这几个是所有编程语言都需要用到的功能
40
00:02:46,030 --> 00:02:48,590
除了编程以外
41
00:02:48,590 --> 00:02:54,830
我现在用MU-FoE来进行邮件的收发与读取
42
00:02:54,830 --> 00:02:59,870
用EL-Feed来进行我RSS管理
43
00:02:59,870 --> 00:03:01,350
来管理我RSS的订阅
44
00:03:01,350 --> 00:03:07,110
基本上我所有的工作流都不用离开Emacs
45
00:03:07,990 --> 00:03:13,270
熟悉我的读者应该还知道我之前还有写一个博客
46
00:03:13,270 --> 00:03:15,790
刘家财.net
47
00:03:15,790 --> 00:03:19,550
感兴趣的读者也可以去参考
48
00:03:19,550 --> 00:03:24,670
由于在之前的公司有个花名叫西瓜
49
00:03:24,670 --> 00:03:29,870
所以说在现在互联网上我的笔名一般是
50
00:03:29,900 --> 00:03:33,900
如果你看见了这个名字一般就是我没错了
51
00:03:33,900 --> 00:03:40,100
好下面介绍一下为什么要做这一档节目
52
00:03:40,100 --> 00:03:44,700
首先我个人是podcast资深受益者
53
00:03:44,700 --> 00:03:51,300
我在很多闲暇时间都会把podcast开着
54
00:03:51,300 --> 00:03:54,100
听的东西也比较杂
55
00:03:54,100 --> 00:03:58,300
与编程相关的无关的都会去听一听
56
00:03:58,300 --> 00:04:00,300
作为一种陪伴音
57
00:04:00,300 --> 00:04:03,900
就像之前小时候家里面没人看电视
58
00:04:03,900 --> 00:04:05,900
电视还要开着一样
59
00:04:05,900 --> 00:04:09,900
另一方面工作了大概有六七年
60
00:04:09,900 --> 00:04:14,300
我发现我们不仅仅需要干巴巴的干货
61
00:04:14,300 --> 00:04:18,900
也需要一些湿货来丰富我们的生活
62
00:04:18,900 --> 00:04:20,900
毕竟人不是机器人
63
00:04:20,900 --> 00:04:22,900
我们的生活是一种生活
64
00:04:22,900 --> 00:04:26,280
就像我们有时候解决一个bug,
65
00:04:26,280 --> 00:04:29,780
飞机了飞了老大进也没有去解决,
66
00:04:29,780 --> 00:04:32,380
但是有可能睡觉就解决了。
67
00:04:32,380 --> 00:04:35,980
所以在做这档节目之前,
68
00:04:35,980 --> 00:04:40,380
我就给他的定位是进行失货知识的分享。
69
00:04:40,380 --> 00:04:45,380
读者不用花费太大的精力来收听,
70
00:04:45,380 --> 00:04:48,780
就把它当做一种陪伴音就好了。
71
00:04:48,780 --> 00:04:53,180
最后一点,作为e-mess的资深用户,
72
00:04:53,180 --> 00:04:57,580
发现这个社区有很多有意思的东西,
73
00:04:57,580 --> 00:05:02,380
然后这些有意思的东西是由谁创造的呢?
74
00:05:02,380 --> 00:05:05,980
我猜想肯定是一些比较有趣的人,
75
00:05:05,980 --> 00:05:09,980
有趣的人肯定会有一些有趣的事情。
76
00:05:09,980 --> 00:05:15,980
希望通过这档节目能把它的内容带给更多的观众。
77
00:05:15,980 --> 00:05:18,700
他们挖掘出来呈现在读者面前
78
00:05:18,700 --> 00:05:23,300
用一句话总结这档节目的目标
79
00:05:23,300 --> 00:05:26,380
就是深入专注e-Market社区
80
00:05:26,380 --> 00:05:29,460
探寻e-Market社区背后的人与事
81
00:05:29,460 --> 00:05:34,820
在开始这档节目之前我也问过我这个问题
82
00:05:34,820 --> 00:05:36,620
为什么是我
83
00:05:36,620 --> 00:05:40,100
为什么要由我来做这件事情
84
00:05:40,100 --> 00:05:41,540
我能做好吗
85
00:05:41,540 --> 00:05:43,020
我能做多久
86
00:05:43,780 --> 00:05:47,380
要回答这些问题其实很难
87
00:05:47,380 --> 00:05:51,660
我也不敢说自己有什么雄心壮志
88
00:05:51,660 --> 00:05:56,700
只希望尽自己的一些力量发挥自己的光和热
89
00:05:56,700 --> 00:05:59,300
私心当然也是有的
90
00:05:59,300 --> 00:06:04,740
就是希望能结识更多的更多志同道合的朋友
91
00:06:04,740 --> 00:06:07,500
毕竟程序员的交际圈
92
00:06:07,500 --> 00:06:12,330
如果说能认识喜欢相同事物的人
93
00:06:12,330 --> 00:06:16,730
我感觉这也是一件对我个人比较有帮助的事情
94
00:06:16,730 --> 00:06:20,130
毕竟多条朋友多条路嘛
95
00:06:20,130 --> 00:06:28,410
最后我在这里向emacs社区内所有乐于分享的朋友发出一个邀请
96
00:06:28,410 --> 00:06:31,410
希望大家能来联系我们
97
00:06:31,410 --> 00:06:36,010
把你自己的故事分享给社区内的所有人
98
00:06:36,410 --> 00:06:40,410
希望大家不要在意自己的emacs水平
99
00:06:40,410 --> 00:06:45,010
毕竟每个人的学习背景知识都不一样
100
00:06:45,010 --> 00:06:49,010
文道有先后 术业有专攻
101
00:06:49,010 --> 00:06:52,010
只要你认为你的故事够精彩
102
00:06:52,010 --> 00:06:54,210
我就希望你来联系我
103
00:06:54,210 --> 00:06:57,410
最后祝大家吃好喝好玩好
104
00:06:57,410 --> 00:06:58,810
下期节目再见
1
00:00:00,000 --> 00:00:10,720
[Music]
2
00:00:10,720 --> 00:00:14,880
Hello and welcome to another episode of "Restation Station" on your host Alan Weimar.
3
00:00:14,880 --> 00:00:18,480
Today I am with Andrew Kelly, the creator of Zig.
4
00:00:18,480 --> 00:00:21,120
It's really a great honor to have a language creator here.
5
00:00:21,120 --> 00:00:23,840
I like I told him before the show, I have great respect for language creators,
6
00:00:23,840 --> 00:00:27,040
especially ones that can get the language very popular.
7
00:00:27,040 --> 00:00:29,920
Also, as you guys have probably heard in different episodes,
8
00:00:29,920 --> 00:00:32,240
we've been asking people what their experience with Zig is,
9
00:00:32,240 --> 00:00:33,920
and we haven't heard much about it.
10
00:00:33,920 --> 00:00:36,160
Myself have heard a lot of good things about Zig,
11
00:00:36,160 --> 00:00:39,120
but the other thing on the other side is I heard people say that Zig just doesn't
12
00:00:39,120 --> 00:00:40,960
quite click for them as it does for Rust.
13
00:00:40,960 --> 00:00:43,760
So I think this is a great opportunity for people to understand, you know,
14
00:00:43,760 --> 00:00:48,640
what is Zig and is it actually better for them than maybe Rust or maybe something else.
15
00:00:48,640 --> 00:00:51,840
So Andrew, why don't you go ahead and introduce yourself and let's get started.
16
00:00:51,840 --> 00:00:54,560
Hey, Alan, nice to meet you and thanks for having me on the show.
17
00:00:54,560 --> 00:01:00,480
So I'm Andrew Kelly, I originally made Zig and have now transitioned into the role of
18
00:01:00,480 --> 00:01:04,080
President of the Board of the Zig Software Foundation,
19
00:01:04,080 --> 00:01:09,200
as well as still the lead developer, the Zig project.
20
00:01:09,200 --> 00:01:11,840
So we're full steam ahead.
21
00:01:11,840 --> 00:01:13,440
Right now we're working towards the...
22
00:01:13,440 --> 00:01:16,720
It's hard for me to talk about anything else because it's...
23
00:01:16,720 --> 00:01:20,480
We're right, super close to finishing the self-hosted compiler,
24
00:01:20,480 --> 00:01:22,960
which is major milestone for any programming language.
25
00:01:23,520 --> 00:01:26,240
Oh, I feel like maybe we should have waited for that to happen now because,
26
00:01:26,240 --> 00:01:27,840
I mean, this is going to happen, right?
27
00:01:27,840 --> 00:01:30,160
I feel like now just too soon to record.
28
00:01:30,160 --> 00:01:32,000
Yeah, it's imminent. We're right on the edge right now,
29
00:01:32,000 --> 00:01:34,960
so it'd be kind of funny to review, to listen to this.
30
00:01:34,960 --> 00:01:37,760
You know, if you're hearing the podcast after it's been released,
31
00:01:37,760 --> 00:01:41,840
it might be kind of funny to hear the difference in attitude and my attitude before and after.
32
00:01:41,840 --> 00:01:44,560
Or could it also be difference in, you know, implementation?
33
00:01:44,560 --> 00:01:48,000
Maybe things change before it gets released and it happens a lot, I believe, right?
34
00:01:48,000 --> 00:01:48,320
Oh, yeah.
35
00:01:48,320 --> 00:01:48,960
What do they say?
36
00:01:48,960 --> 00:01:51,840
The last 10% takes 90% of the time.
37
00:01:53,280 --> 00:01:57,520
This one I haven't heard by, I just remember the 80/20 rule that applies to so many situations,
38
00:01:57,520 --> 00:01:59,040
but that could also be...
39
00:01:59,040 --> 00:02:00,720
Is it really 90/10? I haven't heard this one.
40
00:02:00,720 --> 00:02:02,160
Oh, wait, I got it. I got it. Okay.
41
00:02:02,160 --> 00:02:09,600
The first 90% takes 90% of the time, obviously, and then the last 10% also takes 90% of the time.
42
00:02:09,600 --> 00:02:10,960
That's the joke.
43
00:02:10,960 --> 00:02:12,880
Okay. Got it.
44
00:02:12,880 --> 00:02:15,920
Yeah, I mean, as we're talking before the show for a long time,
45
00:02:15,920 --> 00:02:18,960
I did hear... I did some research about you and Ziglang.
46
00:02:19,680 --> 00:02:23,520
The... My understanding, maybe you can let me know if I misunderstand, but my understanding
47
00:02:23,520 --> 00:02:29,520
about Zig is that Zig is meant to correct the problems of C, right?
48
00:02:29,520 --> 00:02:31,680
Russ is a little bit different in their mindset.
49
00:02:31,680 --> 00:02:35,440
I think it's more about like, they want to make sure things are safe when you program.
50
00:02:35,440 --> 00:02:39,680
And of course, by that, it's like, well, let's compare that to, you know, unsafe things such as C.
51
00:02:39,680 --> 00:02:44,640
But I think Zig, particularly the way that I see it is, they really are trying to replace
52
00:02:45,680 --> 00:02:50,320
C or correct the problems of C in particular. Is that a proper way that I could say the kind
53
00:02:50,320 --> 00:02:51,920
of like the mission statement for Zig?
54
00:02:51,920 --> 00:02:55,200
Yeah. I mean, I think that's fair. If you'll allow me to say it in my own words,
55
00:02:55,200 --> 00:03:03,680
I would say that Russ successfully manages to eliminate a certain category of problems,
56
00:03:03,680 --> 00:03:07,760
which is a really nice benefit and Russ is succeeding in that arena.
57
00:03:07,760 --> 00:03:14,560
But it does that at the cost of complexity and sometimes at the cost of performance.
58
00:03:14,560 --> 00:03:20,800
And so this is a tradeoff. And if you're willing to pay the cost for eliminating entire class of
59
00:03:20,800 --> 00:03:26,320
bugs, then that's great. And Russ is excellent for that tradeoff. But with Zig's approach,
60
00:03:26,320 --> 00:03:32,480
we're looking at the situation and saying, there's a lot we can do to improve on the C or C++
61
00:03:32,480 --> 00:03:36,960
approach to things without giving up simplicity or performance.
62
00:03:36,960 --> 00:03:42,800
So I'd say that's kind of like the Russ Zig tradeoff in their respective domains.
63
00:03:43,360 --> 00:03:47,280
Well, here's the interesting thing. People always talk about performance, right? So I hear a lot of
64
00:03:47,280 --> 00:03:51,120
people say, you know, I don't want to use Russ because performance will suffer. Like you said,
65
00:03:51,120 --> 00:03:56,640
there's some cost to it, right? But you make quite some claims about Zig that even Zig is faster than
66
00:03:56,640 --> 00:04:01,120
C, right? Do you actually have some benchmarks to prove that? Or is it based off of kind of like
67
00:04:01,120 --> 00:04:06,720
wet finger testing? Yeah. So we can look at micro benchmarks or we can look at macro benchmarks,
68
00:04:06,720 --> 00:04:12,640
but at the micro level, the semantics of the language are just more optimizable. So just as an example,
69
00:04:12,640 --> 00:04:19,520
in C, you have a difference between signed and unsigned integers. Even though optimizers would
70
00:04:19,520 --> 00:04:23,520
be able to make more assumptions about unsigned integers because they have a different range,
71
00:04:23,520 --> 00:04:30,000
they're hamstrained by the fact that arithmetic unsigned integers in C is well defined to
72
00:04:30,000 --> 00:04:36,160
wrap. And for some reason, they do this split on signed because if you use a signed integer in C,
73
00:04:36,160 --> 00:04:42,160
then now it's undefined behavior to wrap the integer. So now the optimization of a compiler
74
00:04:42,160 --> 00:04:47,840
is able to do math on signed integers better. But this is kind of a weird arbitrary situation.
75
00:04:47,840 --> 00:04:54,480
So as just a simple example, and Zig arithmetic is there's just different operators for wrapping
76
00:04:54,480 --> 00:05:00,960
or assertion arithmetic. So if you just use the plus operator, then you're asserting that that's
77
00:05:00,960 --> 00:05:05,840
not going to overflow the integer. And that's a difference with C. And you can just look at
78
00:05:05,840 --> 00:05:11,280
like a Godbolt example and just notice that machine code is better for unsigned integers in Zig.
79
00:05:11,280 --> 00:05:16,560
That's like a micro one. And then at the macro level, just take a look at the Zig self-hosted
80
00:05:16,560 --> 00:05:22,240
compiler. It's way faster than them clang at for an equivalent source code size. And that's just
81
00:05:22,240 --> 00:05:29,040
because Zig is a language that guides you towards writing faster code. Okay, yeah, that makes sense.
82
00:05:29,040 --> 00:05:32,080
It's kind of a little bit weird, right? Because like to me, I think about it, it's like, they're
83
00:05:32,080 --> 00:05:35,680
just bits, right? I guess you could just slightly change how you interact with them.
84
00:05:35,680 --> 00:05:39,680
Why would you have undefined behavior that this doesn't make sense for me? Is this like a
85
00:05:39,680 --> 00:05:44,960
committee choice or something? Or is it like initial guys who wrote C kind of did it one way,
86
00:05:44,960 --> 00:05:48,000
and then the committee said, okay, let's do it some other way. Do you have any idea?
87
00:05:48,000 --> 00:05:51,520
Yeah, it's funny that you say they're just bits, right? You're kind of going at this at an
88
00:05:51,520 --> 00:05:56,640
undefined behavior angle. But if I could just side tangent real quick, the idea is you put into your
89
00:05:56,640 --> 00:06:01,680
head, yeah, they are just bits, aren't they? So what if we just treat all of our entire input space
90
00:06:01,680 --> 00:06:06,400
as bits and our output space as bits and just do the best possible thing given the hardware that
91
00:06:06,400 --> 00:06:11,760
we have to make the input go to the output. And that kind of modeling of programs is what makes
92
00:06:11,760 --> 00:06:16,320
your performance the best. But that's not what you're talking about. You're asking me about
93
00:06:16,320 --> 00:06:20,240
undefined behavior. Like, why can't we just define all the behavior is kind of what you're asking?
94
00:06:20,240 --> 00:06:23,760
Is that right? Well, that's a second question, right? My first question is like, wait a minute,
95
00:06:23,760 --> 00:06:26,720
there are just bits, right? You just have to kind of treat them slightly differently, right? If
96
00:06:26,720 --> 00:06:30,400
like you have sign, right, I think it's always the first bit is the one that's, you know,
97
00:06:30,400 --> 00:06:36,720
signed and unsigned. Now, if it's sorry, plus or minus, right? If it's unsigned, then obviously you have,
98
00:06:36,720 --> 00:06:41,280
I don't know what the calculation is up top of my head, but you have more data you can store,
99
00:06:41,280 --> 00:06:47,440
but all positive. So it's just like trying to understand like, why is it such an issue to do
100
00:06:47,440 --> 00:06:51,600
this stuff? And then the second question, like you said, is why is it that we have undefined behavior,
101
00:06:51,600 --> 00:06:56,080
right? Why can't we just define it eventually? And then I think things would work out. But I
102
00:06:56,080 --> 00:07:01,200
understand that there is, you know, a code out there that is using this kind of undefined behavior.
103
00:07:01,200 --> 00:07:05,840
And maybe there is, I mean, the thing is undefined behavior, like, really, nobody writes it. And then
104
00:07:05,840 --> 00:07:10,960
like something somebody actually implements something. And then people just rely on that. Or like,
105
00:07:10,960 --> 00:07:15,040
how can we say something about this kind of situation? I think I can shed some light on this.
106
00:07:15,040 --> 00:07:19,600
So I think that part of what's confusing about undefined behavior for people is that
107
00:07:19,600 --> 00:07:25,040
it's actually a broad term, and we need to kind of narrow in on different kinds of undefined behavior.
108
00:07:25,040 --> 00:07:30,560
So as an example, let's just say that we took Rust and everything's the same, but we're going to make
109
00:07:30,560 --> 00:07:37,520
one change to the language specification. And the change is that if you ever multiply by exactly
110
00:07:37,520 --> 00:07:44,160
1000, that's undefined behavior. Okay, this would be ridiculous. This would be a really bad idea
111
00:07:44,160 --> 00:07:49,040
that would only be a problem. And you would be right to ask, that doesn't make any sense. Why
112
00:07:49,040 --> 00:07:54,160
don't we just define multiplication by 1000 to do what you would expect it to do? And then no one's
113
00:07:54,160 --> 00:08:01,440
going to run into this problem. Right. That's one angle. And the weird thing about C, specifically,
114
00:08:01,440 --> 00:08:08,080
and to some degree, C++ kind of by inheritance, upon intended, is that there are some things in
115
00:08:08,080 --> 00:08:12,000
the specification like this, be skeptical about what I'm about to say, because I can't remember
116
00:08:12,000 --> 00:08:16,400
very clearly. But I think there's something like, if your source file doesn't end in a new line,
117
00:08:16,400 --> 00:08:20,960
it's undefined behavior, or something crazy like that. That's kind of like the multiplying by a
118
00:08:20,960 --> 00:08:25,520
1000 thing. Right. Like, what is that doing in there? Just get that out of there, simplify it
119
00:08:25,520 --> 00:08:31,760
by taking that out. Right. That's like one angle to look at undefined behavior. But there's another
120
00:08:31,760 --> 00:08:37,520
really important different angle to look at. And that is that the compiler needs to make some
121
00:08:37,520 --> 00:08:43,840
assumptions about things that will never happen so that it can do optimizations. And this is true
122
00:08:43,840 --> 00:08:49,040
in Rust too. Like Rust, the Rust compiler needs to assume that certain things will never happen.
123
00:08:49,040 --> 00:08:54,240
And it is doing these things in order to make the output reasonable. And an example of this would be
124
00:08:54,240 --> 00:09:01,200
if you allocate memory from, and then you grab some memory, and I'm holding up my left hand here,
125
00:09:01,200 --> 00:09:06,320
and then I allocate some more memory, and I'm holding up my right hand. And the premise is that
126
00:09:06,320 --> 00:09:12,800
you can never access these two allocations through each other. This is called pointer provenance.
127
00:09:12,800 --> 00:09:18,160
And this is a really, really important assumption for compilers to make. Otherwise,
128
00:09:18,160 --> 00:09:21,760
they're going to out garbage code. So even Rust wants to have this assumption.
129
00:09:21,760 --> 00:09:26,720
And the language is built specifically so that you can never violate this premise.
130
00:09:26,720 --> 00:09:31,280
And that way in the back end, when Rust emits LLVM code, it can promise LLVM,
131
00:09:31,280 --> 00:09:36,400
don't worry, this will never happen. You can safely assume that if one of these pointers
132
00:09:36,400 --> 00:09:41,120
accesses the other pointer's data, that's undefined behavior. And that assumption,
133
00:09:41,120 --> 00:09:46,640
that existence of undefined behavior is what gives the optimizer the capability to do anything
134
00:09:46,640 --> 00:09:51,200
useful at all with the program. So that's the other angle. And I feel like the sometimes the
135
00:09:51,200 --> 00:09:55,920
discourse on undefined behavior gets a little confused because people are thinking about one,
136
00:09:55,920 --> 00:10:00,080
but they're talking about the other. So can we actually talk about undefined behavior? So
137
00:10:00,080 --> 00:10:04,160
I hear this term a lot. And sometimes I'm in meetings with people, with clients, and they
138
00:10:04,160 --> 00:10:07,520
keep using acronyms and I ask them, what does this actually mean? And sometimes they're not even
139
00:10:07,520 --> 00:10:12,560
able to actually tell me or even explain what terms mean. But like, we keep hearing this a lot
140
00:10:12,560 --> 00:10:17,600
in the community, undefined behavior. So undefined behavior means that anything can happen, right?
141
00:10:17,600 --> 00:10:22,400
That there's no true definition. So you can just not expect something. Is that a way to actually
142
00:10:22,400 --> 00:10:27,360
kind of define undefined behavior? Yeah, I mean, what you just said would be a consequence of the
143
00:10:27,360 --> 00:10:32,880
definition, a pithy way that I would try to say it would be undefined behavior is a promise that
144
00:10:32,880 --> 00:10:38,160
the optimizer can assume will never be broken. It's a premise that it's going to operate, that's
145
00:10:38,160 --> 00:10:44,000
going to do its optimizations around. It's going to assume something so that it can know that it's
146
00:10:44,000 --> 00:10:47,680
safe to do certain changes to your code. That sounds like more like when it's operating on
147
00:10:47,680 --> 00:10:52,080
defined behavior. No, that's the way I'm understanding what you're saying. Well, specifically, though,
148
00:10:52,080 --> 00:10:58,400
the undefined behavior is what happens if the premise is violated. So here's an example, I can
149
00:10:58,400 --> 00:11:04,000
make an analogy. Let's say that you buy a computer and the motherboard has the hardware. This is a
150
00:11:04,000 --> 00:11:09,440
hardware analogy. It has the text specs and it says, okay, this thing needs to be powered by five volts.
151
00:11:09,440 --> 00:11:16,240
If you give it one volts, it's not going to behave correctly. It needs five volts, right? So powering
152
00:11:16,240 --> 00:11:21,120
your motherboard with one volt, it's going to have undefined behavior. Who knows what it will do?
153
00:11:21,120 --> 00:11:25,360
Will it be if correctly, will it have wrong results undefined? The only way to get defined
154
00:11:25,360 --> 00:11:29,360
behavior is give it the five volts that the hardware needs. That's like a hardware example.
155
00:11:29,360 --> 00:11:33,040
But we're talking about software. So just take that analogy and apply it to software.
156
00:11:33,040 --> 00:11:37,200
Yeah, how about Zig, though? Does it actually have some undefined behavior?
157
00:11:37,200 --> 00:11:43,200
Yeah, yeah. One of the differences between Zig and Rust is the existence of more or different
158
00:11:43,200 --> 00:11:48,320
categories of release modes. So Rust has a debug, which is the default, and a release,
159
00:11:48,320 --> 00:11:54,480
which you opt into. Zig has a debug, which is the default, and three release modes.
160
00:11:55,200 --> 00:12:02,000
The three release modes are small, fast, and safe. You have to choose one of these three
161
00:12:02,000 --> 00:12:07,920
things. You don't get all of them. So that's a difference with Rust. So in Zig, if you choose
162
00:12:07,920 --> 00:12:15,360
safe, then we have safety checks that check for undefined behavior and we'll make it defined to
163
00:12:15,360 --> 00:12:21,680
call panic instead of invoking undefined behavior. But if you choose small or fast,
164
00:12:21,680 --> 00:12:27,600
then you are opting into the optimizer assuming that undefined behavior will never happen.
165
00:12:27,600 --> 00:12:34,080
And then also, there are some kinds of undefined behavior that even the safe modes cannot detect.
166
00:12:34,080 --> 00:12:39,680
And that's an important fact for the when use cases to use Rust versus to use Zig.
167
00:12:39,680 --> 00:12:45,120
You know, if your goal is 100% in memory safety encapsulation, that's what Rust is going to give
168
00:12:45,120 --> 00:12:49,360
you, because there are some instances in Zig where even our safe mode is not going to catch
169
00:12:49,360 --> 00:12:53,040
certain kinds of undefined behavior. I want to ask a question, but I feel like the way I wanted
170
00:12:53,040 --> 00:12:59,280
to ask it was not not proper. But do you feel that this is not something that you want to actually
171
00:12:59,280 --> 00:13:02,800
fix that you want to make it really safe? I mean, because I can't imagine people saying,
172
00:13:02,800 --> 00:13:07,760
oh, I just want a really, really fast program. I don't really care if the memory is not safe.
173
00:13:07,760 --> 00:13:14,640
Well, there's some cases where that is correct. So as an example, if you're targeting WebAssembly
174
00:13:14,640 --> 00:13:19,040
and you're already going to run the code in the sandbox, then there's no reason to pay the cost
175
00:13:19,040 --> 00:13:23,440
of safety since you're already sandboxing it in the runtime. So that'd be one example.
176
00:13:23,440 --> 00:13:30,000
Another example would be you're shipping a video game like Ocarina of Time to the console or
177
00:13:30,000 --> 00:13:34,480
client's computer, and the player's just going to run the game on their computer. So if they
178
00:13:34,480 --> 00:13:40,400
manage to exploit their own system, then it just kind of doesn't matter. So that'd be another
179
00:13:40,400 --> 00:13:47,520
fair example. But and also answer to your question, I do have a personal goal changing this list
180
00:13:47,520 --> 00:13:53,360
to be roughly equivalent to like, go or rust in terms of safety. So as an example, one of the
181
00:13:53,360 --> 00:13:59,840
problem areas right now would be escaped pointers to local variables. So you have a function,
182
00:13:59,840 --> 00:14:05,280
take the address of a local variable, and then you store that somewhere, and then the function
183
00:14:05,280 --> 00:14:10,000
returns. That pointer now becomes a dangling pointer. And if you use it, that's called a use
184
00:14:10,000 --> 00:14:15,200
after free. Now there is an important difference between Zig and Rust here, which is that in Rust,
185
00:14:15,200 --> 00:14:20,480
the existence of that pointer is already undefined behavior. I hope someone can correct me if I'm
186
00:14:20,480 --> 00:14:24,480
wrong. I might be wrong about this exact example, but I know that Rust does have an important
187
00:14:24,480 --> 00:14:30,640
distinction about even creating like bad types, even if they're never like loaded or stored,
188
00:14:30,640 --> 00:14:35,200
that's already undefined behavior. Whereas in Zig, only an access would cause the problem. So you
189
00:14:35,200 --> 00:14:40,000
can actually store it fine as long as you never load or save it later. Anyway, my point is that
190
00:14:40,000 --> 00:14:45,120
I do actually have a plan to address this, which is to do escape analysis on local variables,
191
00:14:45,120 --> 00:14:51,440
keep allocate them with an allocator that does not reuse virtual memory addresses,
192
00:14:51,440 --> 00:14:56,960
free them at the end of the function, and then these no longer will cause use after free. They'll
193
00:14:56,960 --> 00:15:04,000
cause either a segfault or undefined value will be caught. So in summary, there's two
194
00:15:04,000 --> 00:15:10,400
answers to this question. One is it's actually okay to take certain risks for certain targets.
195
00:15:10,400 --> 00:15:17,600
And number two is I actually do want to bring this list down roughly to go or Rust safety level,
196
00:15:17,600 --> 00:15:23,680
but we're not at 1.0 yet. So check back then and you can evaluate the safety of Zig at that point
197
00:15:23,680 --> 00:15:28,800
in time. Yeah, that was actually what I wanted to ask next was like, you know, Rust has this
198
00:15:28,800 --> 00:15:33,520
thing that since once point, oh, they always want to remain backwards compatible. Is it going to
199
00:15:33,520 --> 00:15:38,960
have the same kind of guarantees? 1.0. Yeah, yeah, our goal is to pretty much just never touch the
200
00:15:38,960 --> 00:15:45,520
language again after 1.0. Now that could be a catalyst to have a never-reducing 1.0 kind of
201
00:15:45,520 --> 00:15:49,920
stage is that the way you see it happening or you actually see a 1.0 happening sometime relatively
202
00:15:49,920 --> 00:15:55,600
soon. Yeah, I mean, I see what you're saying, but it's offset by the fact that the language is just
203
00:15:55,600 --> 00:16:02,080
so much simpler than other languages. So while yes, it's still a monumental amount of work, it is
204
00:16:02,080 --> 00:16:07,680
lessened by the fact that the language doesn't require it's a much more finite set of language
205
00:16:07,680 --> 00:16:14,640
features than other projects. So I do know that people are using Zig in production, right? And so
206
00:16:14,640 --> 00:16:21,280
how are they handling like if there is changes to the language, right? Is there an upgrade guide or
207
00:16:21,280 --> 00:16:25,520
is there like, I think in some languages, they have like a tool that which can scan the code and
208
00:16:25,520 --> 00:16:30,000
change it for you. Do you have something like this? Yeah, we have both of these things. Yeah, so if
209
00:16:30,000 --> 00:16:35,040
any listeners this podcast right now, I would encourage you to go to the Zig website and just
210
00:16:35,040 --> 00:16:42,160
look at the latest release notes for, I don't know, 0.9.0 and then just scroll down in awe of two weeks
211
00:16:42,160 --> 00:16:51,600
that I just spent typing away these notes very laboriously, but I just but also, yeah, we sometimes
212
00:16:51,600 --> 00:16:56,080
are able to have the Zig Formatter tool, auto upgrade things. It doesn't have type awareness,
213
00:16:56,080 --> 00:17:00,160
so it's limited in what it can do, but when it can, it's pretty ideal. Now, what kind of things does
214
00:17:00,160 --> 00:17:04,400
it actually do for you? Does it rename variables? Does it just change the syntax or what kind of
215
00:17:04,400 --> 00:17:08,400
things does it actually do for you? Yeah, I was thinking about the formatter. Yeah, the formatter
216
00:17:08,400 --> 00:17:12,800
and if it does actually change and upgrade your code for the new version. Yeah, I mean, it's a
217
00:17:12,800 --> 00:17:18,640
pretty standard formatter. If you've ever used Go format, it's pretty much the same. I don't have
218
00:17:18,640 --> 00:17:22,400
any experience with Rust format. I don't know how that works, but yeah, there's no configuration
219
00:17:22,400 --> 00:17:27,280
options. It's opinionated, so everyone has to use the same style. And then what we do is just,
220
00:17:27,280 --> 00:17:31,200
I don't know, let's say that one of the built-in functions gets renamed, it's able to just do that
221
00:17:31,200 --> 00:17:35,520
rename for you and forget what I was going to say, but it doesn't have access to type information.
222
00:17:35,520 --> 00:17:39,920
So the only thing you can do is send tactical changes. So there must be like the AST or something
223
00:17:39,920 --> 00:17:45,600
like that, that kind of level. The main purpose of the formatter is just reformat the code. So
224
00:17:45,600 --> 00:17:50,320
double-purposing it, do language upgrades sometimes works and sometimes does not work.
225
00:17:50,320 --> 00:17:54,800
Please don't tell me that you also add underscores between the thousands place
226
00:17:54,800 --> 00:18:02,160
and numbers, do you? Automatically? Yeah. No. I actually rejected that language proposal for a
227
00:18:02,160 --> 00:18:07,360
while, but then I caved. Okay. To even support underscores and integer literals at all.
228
00:18:07,360 --> 00:18:12,240
I totally am okay with that, but what I really hate is like a formatter that I use for Elixir.
229
00:18:12,240 --> 00:18:15,440
They only, like you said, it's also opinionated, right? It follows very much the same ideas,
230
00:18:15,440 --> 00:18:20,720
but for some reason they decided to automatically add the thousands separated underscores in between
231
00:18:20,720 --> 00:18:25,600
and it drives me nuts because sometimes I have an integer that actually is a reference for something
232
00:18:25,600 --> 00:18:30,400
from a client and it's like, okay, you know, I format all the time because I want my code to look
233
00:18:30,400 --> 00:18:35,280
okay, but then I do command F or command shift F try to find that integer and I cannot find it
234
00:18:35,280 --> 00:18:40,720
because it's going to be a formatter. Yeah. That's annoying. Also, that's a regional thing. So if you
235
00:18:40,720 --> 00:18:44,880
put something in the thousands place, then that might actually just not be what a different culture
236
00:18:44,880 --> 00:18:50,400
does. So it's just kind of weird. You know, it's opinionated. So what can I do? But that's my biggest
237
00:18:50,400 --> 00:18:53,280
gripe. Otherwise, everything else is fine. I don't really care too much about other stuff.
238
00:18:53,280 --> 00:18:56,880
It's kind of nice having a formatter opinion because you don't need to fight about code style.
239
00:18:56,880 --> 00:19:01,280
Just run the formatter and go. Yeah, that's the idea. Yeah. We do have a kind of a nice thing
240
00:19:01,280 --> 00:19:06,160
where if you want to put, so Zig just supports commas at the end of lists and stuff. I think
241
00:19:06,160 --> 00:19:11,680
Rust does too, if I remember correctly. So like enums or structs or even function calls. Anyway,
242
00:19:11,680 --> 00:19:18,800
point being if you just trail your an extra comma, the formatter will actually notice that and then
243
00:19:18,800 --> 00:19:22,000
say, I see that you want it to put everything on a separate line. I'll just go ahead and do that
244
00:19:22,000 --> 00:19:26,000
for you. And then likewise, if you delete the trailing comma, it'll say, Oh, okay, I guess you
245
00:19:26,000 --> 00:19:29,600
want me to put it on one line. Okay, I'll go ahead and do that. You kind of communicate to the
246
00:19:29,600 --> 00:19:34,000
formatter based on the existence of the trailing comma or not. I kind of really liked that because
247
00:19:34,000 --> 00:19:38,320
like it does affect me because I don't want to like add in a bunch of artificial changes. It's
248
00:19:38,320 --> 00:19:41,920
like, okay, I just want to add an extra item to the end of this list. Well, that means I have to
249
00:19:41,920 --> 00:19:46,720
actually change two lines, which is just yeah, yeah, that's a good reason for things on different
250
00:19:46,720 --> 00:19:50,720
lines. Yeah, kind of reminds me of when I worked in the bank before and like the most productive
251
00:19:50,720 --> 00:19:55,840
person according to get changes was actually the configuration guy who would just manage the ammo
252
00:19:55,840 --> 00:20:00,400
files all day, because you just be adding and removing stuff. And then eventually decided to
253
00:20:00,400 --> 00:20:04,480
start gamifying his work, because you know, oh, you just add a space remove a space,
254
00:20:04,480 --> 00:20:08,480
commit it. And then at the end of the day, look how many lines of code you changed this month,
255
00:20:08,480 --> 00:20:11,920
you tripled your output, what's going on, you're doing a good job, here's a race.
256
00:20:11,920 --> 00:20:16,240
Oh, wow, they wait. So their performance was actually being measured by lines of code.
257
00:20:16,240 --> 00:20:20,800
So when I was working in the bank, we were working on, you know, cost allocations, right?
258
00:20:20,800 --> 00:20:24,880
Because here's the thing is that IT people, how do you judge the value of a person?
259
00:20:24,880 --> 00:20:29,760
If you sit down with somebody, you're assigned to help them optimize their work day, right? Usually,
260
00:20:29,760 --> 00:20:34,320
it means writing a piece of software. But let's say that you, you know, did all your checking,
261
00:20:34,320 --> 00:20:37,440
and all of a sudden at the end of the day, you say, actually, if you just remove these pieces and
262
00:20:37,440 --> 00:20:42,400
then connect this stuff and whatever, you can actually save yourself three hours or whatever,
263
00:20:42,400 --> 00:20:46,080
right? Just give me an idea. There's times when you're a developer, I'm sure you know this,
264
00:20:46,080 --> 00:20:50,880
where you can find ways to improve without actually writing a piece of code.
265
00:20:50,880 --> 00:20:56,240
To improve your own skill or to improve some of the company's infrastructure or what?
266
00:20:56,880 --> 00:21:01,760
You can improve the company's way of doing things, right? So a lot of times people say,
267
00:21:01,760 --> 00:21:05,600
okay, I want to make my process better. Let me just get the developer to write
268
00:21:05,600 --> 00:21:11,360
software for me, so I can just drag and drop and go all my day. It's like, well, wait a minute,
269
00:21:11,360 --> 00:21:16,000
this car is coming from Dropbox, and you want to just email to this person. So why not just have
270
00:21:16,000 --> 00:21:20,480
Dropbox automatically send the invite and share the link, and then you're ready to go. Oh, I didn't
271
00:21:20,480 --> 00:21:24,640
know we could do that. Okay. Honestly, like you can find simple things without writing a piece of
272
00:21:24,640 --> 00:21:30,640
code or a lot of code. And then how do you measure that? Yeah, you need a human actually using
273
00:21:30,640 --> 00:21:35,040
critical thinking in order to measure that. Exactly. And also like, I mean, everything too is,
274
00:21:35,040 --> 00:21:39,120
if you're pair programming, which is what we did a lot also, how do you measure that? Because if
275
00:21:39,120 --> 00:21:43,360
I'm telling you what to write and you're just typing away, technically, I think the guy who's got
276
00:21:43,360 --> 00:21:47,680
the idea and it works very well is probably contributing more, right? I mean, you're just typing out the
277
00:21:47,680 --> 00:21:52,160
stuff. We can discuss that one, but that's my thought on it. So now it's the guy who wrote
278
00:21:52,160 --> 00:21:56,800
everything who gets all the credit. So like, yeah, it's interesting. Because the thing is,
279
00:21:56,800 --> 00:22:00,960
IT salaries are quite high in relative comparison to like a regular clerk. So how do you judge the
280
00:22:00,960 --> 00:22:06,400
value? Yeah, well, I will say one thing. I think that how you judge the value is different,
281
00:22:06,400 --> 00:22:11,280
depending on if you're a large company or a small one. In any case, they had basically had four
282
00:22:11,280 --> 00:22:16,880
buckets, right? Equipment, people's salaries, IT equipment, because you know, servers and stuff
283
00:22:16,880 --> 00:22:22,960
are not cheap. And IT salaries, because IT salaries are, you know, rather high in comparison for the
284
00:22:22,960 --> 00:22:26,720
same people. And over here, they just keep trying to get more developed. Anyways, I'm talking too
285
00:22:26,720 --> 00:22:30,480
much about my own stuff, right? But in general, right? I forgot why we got onto this topic. But
286
00:22:30,480 --> 00:22:36,080
yeah, I mean, judging value is really difficult. I completely agree that judging value is of human
287
00:22:36,080 --> 00:22:41,600
contributions is very difficult. Okay, so where are we going with this? Yeah, so maybe this is a
288
00:22:41,600 --> 00:22:45,440
good time since we both kind of, at least for me, I lost my way. What else going with everything?
289
00:22:45,440 --> 00:22:48,880
Why don't we talk more about your past, right? Because I think it gives us a good idea about,
290
00:22:48,880 --> 00:22:53,120
you know, where you came from and why you decided to get onto this path. Now, you started off,
291
00:22:53,120 --> 00:22:57,200
you're definitely doing higher level languages, right? At the beginning. Yeah, earlier on, yeah,
292
00:22:57,200 --> 00:23:07,360
I started with Visual Basic 6, I did Pearl, Python, JavaScript, C++, Java, C, then Rust,
293
00:23:07,360 --> 00:23:12,560
then I made Zig. Now, VB is kind of known. They're not a very popular language, right? At the time,
294
00:23:12,560 --> 00:23:16,720
though, I guess I worked out for you now. I mean, as for a 12 year old, it was awesome.
295
00:23:16,720 --> 00:23:19,280
Okay, fine. 12 years old. Okay, I can't judge a 12 year old, I guess.
296
00:23:19,280 --> 00:23:24,640
Yeah, I just know that in the programming world that people would say, oh, VB is not good,
297
00:23:24,640 --> 00:23:29,040
et cetera. I never really got into VB. I never really did basic. I think I did basic once
298
00:23:29,040 --> 00:23:34,880
when I was playing around with robots in university. We had a class called Build Your Own Robot Army,
299
00:23:34,880 --> 00:23:39,840
and we're actually able to write basic for something. Wait, you're doing some kind of like software,
300
00:23:39,840 --> 00:23:43,840
like bots fighting each other? Well, the name of the course was How to Build Your Own
301
00:23:43,840 --> 00:23:48,960
Robot, Evil Robot Army, was actually the name of the course. So, oh, wow. So for my school, we have,
302
00:23:48,960 --> 00:23:53,520
it's a trimester school. So you got your spring, you got your fall, but in the middle of January,
303
00:23:53,520 --> 00:23:57,440
it's something called J-term. So you can take off, which doesn't really make sense because in
304
00:23:57,440 --> 00:24:02,240
general, you pay for that, right? You can take a trip, which I did also one time I went to China,
305
00:24:02,240 --> 00:24:06,320
and that's actually part of a course, right? And then the other one is that you could take a course.
306
00:24:06,320 --> 00:24:10,320
You sit in class about four hours a day, every day for like the whole month,
307
00:24:10,320 --> 00:24:13,920
and you can get the course done. So it could be maybe you get a missing credit that you need.
308
00:24:13,920 --> 00:24:18,240
Some courses are only taught in J-term, and sometimes there's courses like that, which are kind of like
309
00:24:18,240 --> 00:24:22,960
fun courses. You get the credit and everything, but they're more fun, right? Building robots
310
00:24:22,960 --> 00:24:27,440
every day for four hours is kind of fun. That sounds great. Was there hardware involved?
311
00:24:27,440 --> 00:24:30,320
It was all hardware in the beginning, and then at the very end, we had a special chip that we
312
00:24:30,320 --> 00:24:35,920
could actually program. Wow. Wait, you said a robot army? So were you making them like swarm or
313
00:24:35,920 --> 00:24:41,680
something? For some names may be confusing, right? So the name of the course was How to Build Your Own
314
00:24:41,680 --> 00:24:46,640
Evil Robot Army, but we were not making swarms of armies of robots. I wish we were. That would be
315
00:24:46,640 --> 00:24:50,960
fun, but maybe not enough time and four hours a day for only the month of January. Okay, so you
316
00:24:50,960 --> 00:24:55,760
made one robot. I made several different robots, and I think they would basically build a robot,
317
00:24:55,760 --> 00:25:00,400
and then disassemble it, and then make a new one. That sounds really cool. It's like over 10 years
318
00:25:00,400 --> 00:25:04,640
ago, right? I'm getting old over here. I can't remember exactly what we did. Yeah, it was something
319
00:25:04,640 --> 00:25:09,760
like that, right? So it sounds cool, but the details of them have done anything to take that class when
320
00:25:09,760 --> 00:25:13,680
I was young. Yeah, I'm not saying it wasn't fun, but why are we talking about this again? I totally
321
00:25:13,680 --> 00:25:18,320
forgot. Oh, you said that you heard the Visual Basic was a bad language. Oh, yeah, yeah, sorry.
322
00:25:18,320 --> 00:25:22,320
Yeah, so yeah, visual. And then I remember that for programming, that was actually basic, right?
323
00:25:22,320 --> 00:25:27,200
And that was my first and only time I've actually using basic. So quite basic in terms, right? But
324
00:25:27,200 --> 00:25:31,280
I do know that basic was a huge thing, right? I mean, Microsoft wrote basic, I think for the first
325
00:25:31,280 --> 00:25:36,800
Apple or the second Apple II, I think it was. They sold basic to one of those original switches
326
00:25:36,800 --> 00:25:42,000
with that computer. What is that? The altar, I think it was. That's before my time. You're teaching
327
00:25:42,000 --> 00:25:47,280
me history at this point. I would thought you would know this stuff. No, I'm only 33. We're about
328
00:25:47,280 --> 00:25:52,160
the same age. I'm just the promise that I love you too much. That's the issue. But any case, right?
329
00:25:52,160 --> 00:25:55,760
So you did VB at 12 years old. What kind of stuff are you doing with VB? And by the way,
330
00:25:55,760 --> 00:26:00,800
you know, as much as I could, but also not that much. My parents only let me use the computer,
331
00:26:00,800 --> 00:26:07,200
actually any electronics for one hour a day, which as you know, programming is a pretty time-consuming
332
00:26:07,200 --> 00:26:12,560
hobby. So it was pretty challenging. I read a lot of books and then like planned out everything I
333
00:26:12,560 --> 00:26:16,720
would do on paper so that when I like got my hour, I would just like put it in the computer as fast
334
00:26:16,720 --> 00:26:21,600
as possible. But I forget what your actual question was. No, I was just curious about what you were
335
00:26:21,600 --> 00:26:25,440
actually kind of programming with, but I can understand like, so was it like actually kind of like you
336
00:26:25,440 --> 00:26:30,000
were acting like programmers were a long time ago where it's like you had to wait in line to drop
337
00:26:30,000 --> 00:26:33,520
your card into the machine? Yeah, kind of. Yeah. But even though it was sitting right there,
338
00:26:33,520 --> 00:26:38,720
I just wasn't allowed to use it most of the time. Yeah, I would just try anything. So I,
339
00:26:38,720 --> 00:26:43,440
what did I do? I tried to make like a WYSIWYG website editor, which did not work very well.
340
00:26:43,440 --> 00:26:48,240
I made a lot of games without learning anything about game design yet. So I have a lot of like
341
00:26:48,240 --> 00:26:53,120
bad game ideas that I did. I did make one kind of fun thing, which was like a macro recorder.
342
00:26:53,120 --> 00:26:58,880
So record your keyboard and mouse movements and then replay them. And I actually managed to prank
343
00:26:58,880 --> 00:27:02,240
my high school teacher with that one years later. So that was pretty funny.
344
00:27:02,240 --> 00:27:08,320
Yeah, I mean, to me just experimenting with like the Windows APIs and just learning how to code was
345
00:27:08,320 --> 00:27:13,840
really fun. So from there on, you're like, wow, I really want to continue working on with computers
346
00:27:13,840 --> 00:27:17,680
or continue programming or just like this is just fun to play around with at the beginning.
347
00:27:17,680 --> 00:27:21,760
Well, I had a lot of hobbies. I also got into animation. I was really involved in albino
348
00:27:21,760 --> 00:27:26,080
black sheep back in the day. I got on day using FL Studio to try to make music,
349
00:27:26,640 --> 00:27:31,680
I tried learning piano. What else? I wanted to like build hardware, but I just didn't
350
00:27:31,680 --> 00:27:35,600
wasn't smart enough to figure out how to get started and none of the adults around me figured
351
00:27:35,600 --> 00:27:39,280
out that they needed to just buy me a book on hardware. And I didn't know that that's what I needed.
352
00:27:39,280 --> 00:27:44,720
So that never happened. But anyway, there's alternate universes in which I have many different
353
00:27:44,720 --> 00:27:48,640
specialties. But yeah, in this one, I landed on software. Yeah, I think I hear that in some
354
00:27:48,640 --> 00:27:52,160
podcasts. Like if you want to develop, or what would you be? And you hear some interesting answers,
355
00:27:52,160 --> 00:27:57,280
some of them actually like a farmer or artist sounds like you have many different possibilities.
356
00:27:57,280 --> 00:28:02,640
Yeah, I like just love to create, you know. So what happened after VB, right? So after some time
357
00:28:02,640 --> 00:28:07,760
you're playing with VB and then like when do you think you really started to realize that, hey,
358
00:28:07,760 --> 00:28:12,080
this is actually what I want to do. I want to program. I love this. I think it's just the hobby
359
00:28:12,080 --> 00:28:18,560
that I kept coming back to. So, you know, when it came time to pick a major in college, it was
360
00:28:18,560 --> 00:28:22,800
an obvious choice to go with computer science. That's basically it. Not much more to say there.
361
00:28:22,800 --> 00:28:30,400
What was your first job actually out of university? Amazon.com. It was the worst job I ever had. I
362
00:28:30,400 --> 00:28:35,520
started looking for a different job after just three months after moving across the country
363
00:28:35,520 --> 00:28:40,400
for this dream job out of college. Wow, I'm sure a lot of people at home are thinking like,
364
00:28:40,400 --> 00:28:43,600
wow, that doesn't make any sense because we all want to work for Amazon because they're one of
365
00:28:43,600 --> 00:28:49,760
the biggest rust hires or kind of rust places out there, I would say. Amazon is really good at treating
366
00:28:49,760 --> 00:28:55,520
programmers like cogs in a machine. So you're not going to have a good experience at Amazon,
367
00:28:55,520 --> 00:29:02,240
but you will be exploited for labor effectively. And Jeff Bezos will make a lot of money and you'll
368
00:29:02,240 --> 00:29:06,640
quit soon after like a year because of the high attrition rate. But it doesn't matter because
369
00:29:06,640 --> 00:29:10,880
someone will replace you and they've designed a system where everyone is replaceable. It sucks.
370
00:29:10,880 --> 00:29:15,200
Don't work there. But I mean, as a business owner, right? For me, I can give the idea that, hey,
371
00:29:15,200 --> 00:29:19,040
I do want people to be replaceable because you don't want to rely your whole business on somebody.
372
00:29:19,040 --> 00:29:22,560
Yeah, I mean, if your only goal is to make money. Yeah. Well, I mean, not about that, right? You
373
00:29:22,560 --> 00:29:26,800
need to be able to handle people leaving, especially for tech, right? People always change jobs. That's
374
00:29:26,800 --> 00:29:31,360
kind of, oh, you're still at the same job for what? Two years? That doesn't make sense. Why don't you
375
00:29:31,360 --> 00:29:36,960
change jobs? I mean, okay. I see what you're saying, right? Your point is that the business needs to
376
00:29:36,960 --> 00:29:42,640
survive, you know, like regular, healthy employee turnover, which is a fair point. But you also need
377
00:29:42,640 --> 00:29:48,160
to, from another angle, people need to have a place where they can fit in and they can feel
378
00:29:48,160 --> 00:29:53,360
like they're doing important work. And if you are just completely replaceable, you're not doing
379
00:29:53,360 --> 00:29:59,680
important work. You don't have a place to fit in. And it's not a happy, fulfilling job. Like,
380
00:29:59,680 --> 00:30:05,200
at some point, in order to just have a healthy working environment, you have to give people
381
00:30:05,200 --> 00:30:10,960
some autonomy and some responsibility and some meaning. So what you think would be a healthy
382
00:30:10,960 --> 00:30:17,120
situation between an employer and employee where an employer, their employee is replaceable, but
383
00:30:17,120 --> 00:30:21,680
still not quite replaceable. I'm not sure how you'd even define that in a way that
384
00:30:21,680 --> 00:30:26,080
is easily understandable from the employer side. I mean, I think this is a pretty natural
385
00:30:26,080 --> 00:30:32,160
phenomenon. So if you take any average company who's hiring, they're spending company resources
386
00:30:32,160 --> 00:30:37,920
trying to find a new candidate, right? And when that person, if they find someone qualified and
387
00:30:37,920 --> 00:30:42,000
they join, they have then have to train them, have to catch them to speed and that person has
388
00:30:42,000 --> 00:30:47,840
to take time to get familiar with not only like the code, but also the people and how to work well
389
00:30:47,840 --> 00:30:51,840
with other people and all the nuances of everyone's personalities and that sort of thing. What is
390
00:30:51,840 --> 00:30:56,400
that called? Institutional knowledge? I forget what it's called. But I mean, this, we already have
391
00:30:56,400 --> 00:31:01,120
words for these things, right? This is already just an observable phenomenon in the real world.
392
00:31:01,120 --> 00:31:06,640
And companies generally don't want people to quit too much or too fast. They don't want
393
00:31:06,640 --> 00:31:11,840
to hire attrition rate because it's inefficient to be hiring all the time. It's more efficient for
394
00:31:11,840 --> 00:31:16,640
the existing people to invest in your existing employees and have them do good work and better
395
00:31:16,640 --> 00:31:20,560
and better work as they get more and more familiar and power and ability within the
396
00:31:20,560 --> 00:31:25,600
organization to accomplish the goals that help the organization. So I don't think I'm saying
397
00:31:25,600 --> 00:31:29,840
something outrageous. I mean, I think I'm just describing an existing phenomenon and I'm just
398
00:31:29,840 --> 00:31:36,720
pointing out that Amazon has optimized for a high attrition rate. They said, fine, if you all are
399
00:31:36,720 --> 00:31:41,920
going to quit because it sucks to work here, we're just optimizing our business around that being a
400
00:31:41,920 --> 00:31:48,000
premise. So screw you, we don't care if you're happy or not. Yeah, I mean, I understand from both
401
00:31:48,000 --> 00:31:52,400
sides, right? It's like you want to feel valued. You want to feel like you fit in. You want to have
402
00:31:52,400 --> 00:31:57,840
all this kind of stuff at the same time. It's like, well, people naturally will go wherever they want
403
00:31:57,840 --> 00:32:02,160
to go. I mean, it depends on the motivation, right? Some people are motivated by money. There's not
404
00:32:02,160 --> 00:32:07,680
much you can do about that. Some people are motivated by whatever, right? Whatever the motivation is.
405
00:32:07,680 --> 00:32:12,160
I mean, there's been some people who, like I recently hired some guy, he said, you know, I really want
406
00:32:12,160 --> 00:32:15,840
to work here. I just didn't have anything for him to work at the time. So I just say, hey, you have
407
00:32:15,840 --> 00:32:20,000
to wait for a moment. And he was basically like, listen, I really want to work with you. I got some
408
00:32:20,000 --> 00:32:24,560
other offers, but you know, I'm willing to wait, but I can't wait for so long, right? Because he's got
409
00:32:24,560 --> 00:32:29,200
things to handle, right? So I mean, there's this kind of thing, right? But there's other people who
410
00:32:29,200 --> 00:32:33,520
just like, oh, I got this, you know, I got this offer today. You know, what can you do about it?
411
00:32:33,520 --> 00:32:37,600
Can you match it? It's like, well, you know, how do I handle that? Right? Like, why you actually
412
00:32:37,600 --> 00:32:41,280
hear? Do you actually want to be here? So that's, I mean, there's so many ways to look at it,
413
00:32:41,280 --> 00:32:44,800
right? But it's good to hear your side. And I think you have some points, obviously.
414
00:32:44,800 --> 00:32:48,480
Yeah. I mean, you're talking to someone who's running a nonprofit. So we obviously have different
415
00:32:48,480 --> 00:32:53,840
motives than a company whose explicit goals are to give a return on an investment.
416
00:32:54,320 --> 00:32:58,160
Well, yeah, I mean, but you're also for a nonprofit, you also have to explain, okay, I paid this money
417
00:32:58,160 --> 00:33:02,960
for this person, then, you know, here's the output, right? As a nonprofit, I think you have to have
418
00:33:02,960 --> 00:33:06,400
something like that. Every time you spend money, I think you have to kind of justify it.
419
00:33:06,400 --> 00:33:09,920
Yeah, how it works for nonprofits is you have a mission statement, which is public. You can go
420
00:33:09,920 --> 00:33:15,760
look at ours on our homepage. And your legal responsibility is to spend all of your funds,
421
00:33:15,760 --> 00:33:20,080
all of them. So nobody gets any, you know, there's no leftover funds in a nonprofit. You have to spend
422
00:33:20,080 --> 00:33:25,520
all your funds serving the mission statement. So when people donate money to us, then presumably
423
00:33:25,520 --> 00:33:30,080
what they're thinking is that submission statement, I can stand behind. I trust the people involved
424
00:33:30,080 --> 00:33:33,760
that they are going to use this money to work towards that mission statement.
425
00:33:33,760 --> 00:33:38,000
You know what? I think this is a perfect segue. I do want to go back to your career,
426
00:33:38,000 --> 00:33:41,760
but I think this is a perfect segue since you're already thinking about the nonprofit. Rust has a
427
00:33:41,760 --> 00:33:47,040
nonprofit, right? And I did interview Rebecca Rumbel, the episode's not out yet at the time of
428
00:33:47,040 --> 00:33:51,120
this recording. But she did quite explain about what their mission statement is and what they're
429
00:33:51,120 --> 00:33:55,840
doing. Can you talk a little bit more about what Zig mission statement is and what you guys are
430
00:33:55,840 --> 00:34:02,400
doing as a nonprofit? Yeah, sure. Yeah. So we're 501c3, same as the Python software foundation.
431
00:34:02,400 --> 00:34:06,880
And we actually published all of our financial transactions recently. So you can just go look
432
00:34:06,880 --> 00:34:12,800
them up if you want every single one. And that's all open. And if you do that, what you'll find is
433
00:34:12,800 --> 00:34:18,880
that almost all the money goes directly towards paying contributors who are working on the Zig
434
00:34:18,880 --> 00:34:24,320
project. And that's something I'm really proud of. It's a really efficient organization. And it's
435
00:34:24,320 --> 00:34:29,200
using the donations that we get to send that money directly to people who deserve it for working
436
00:34:29,200 --> 00:34:33,760
on Zig. Now, to be clear, there are people, a lot of people who are doing really good work,
437
00:34:33,760 --> 00:34:38,400
and they're not getting paid. They're just volunteering their time for the open source project. I would
438
00:34:38,400 --> 00:34:43,840
love to pay them if we had more budget. But obviously we have to spend wisely and not too much.
439
00:34:43,840 --> 00:34:47,920
Well, I mean, I guess you can kind of disclose like, what are some of the developers actually
440
00:34:47,920 --> 00:34:53,360
getting paid? Are they can pay per patch or some kind of weekly thing or a stipend or what kind of
441
00:34:53,360 --> 00:34:59,040
thing are usually they get paid with? Everyone has a pretty similar contract. It's 50 US dollars
442
00:34:59,040 --> 00:35:07,200
per hour. They set whatever schedule they want. And the like what they're supposed to work on is
443
00:35:07,200 --> 00:35:12,640
intentionally loose so that they can decide what they think is best for the Zig project.
444
00:35:12,640 --> 00:35:17,840
And they get paid for their time. No questions asked. Because the thing that we were able to do
445
00:35:17,840 --> 00:35:23,680
is pick people who already demonstrated intrinsic motivation to help the project. So for example,
446
00:35:23,680 --> 00:35:29,840
one of our full-time hires is Jakub Kanka. He does awesome work. And the thing is he was already
447
00:35:29,840 --> 00:35:35,680
volunteering his free time before he became a full-time hire. So it's kind of an advantage that we have
448
00:35:35,680 --> 00:35:41,840
over startup because he demonstrated before he even saw any money that he cared about the project.
449
00:35:41,840 --> 00:35:48,000
He wanted to succeed and that he could self-direct. So he doesn't require management. He just knows
450
00:35:48,000 --> 00:35:52,560
what he wants to do and he has a good sense for it already. I don't need to tell him what to do.
451
00:35:52,560 --> 00:35:58,960
And that contract is the same kind that everyone has. So everyone has a high level of trust and
452
00:35:58,960 --> 00:36:04,480
they're paid by the hour. Their schedule is whatever they want it to be. And their tasks are self-directed.
453
00:36:04,480 --> 00:36:08,560
That's not a huge amount of money. I mean, 50 bucks an hour, I think is not a lot in comparison to
454
00:36:08,560 --> 00:36:13,280
other companies, especially like you said Amazon. So I mean, their motivation is probably not
455
00:36:13,280 --> 00:36:18,400
money, obviously, right? My understanding is that, well, actually, I'm going to try and protect the
456
00:36:18,400 --> 00:36:23,840
privacy of people. So I don't want to say too much. But my understanding that it's a comfortable
457
00:36:23,840 --> 00:36:30,320
rate for those who are getting it and not the United States. And but also I do want to see that
458
00:36:30,320 --> 00:36:36,480
higher. I do want to keep the rate competitive. And I think that as we move forward, I think that
459
00:36:36,480 --> 00:36:40,400
we'll be able to take in more donations. And I think that we will be able to do that. I'm hoping
460
00:36:40,400 --> 00:36:44,960
that that is the case within the next couple of years. I mean, the way I looked at it, right?
461
00:36:44,960 --> 00:36:48,960
I think, yeah, you're right overseas. That could be quite a bit of money. But let's just say the
462
00:36:48,960 --> 00:36:54,640
person is in like US or when he's kind of higher level European countries. Now, in that case, right,
463
00:36:54,640 --> 00:36:59,040
you could say, okay, this is not really meant for them to necessarily live on, but it is meant for
464
00:36:59,040 --> 00:37:03,200
them to say like, thank you. And then they could use that to say maybe get a new laptop that they
465
00:37:03,200 --> 00:37:08,160
could use for contributing more. Like the new M1 ships are coming out. Those ones could help them
466
00:37:08,160 --> 00:37:12,400
compile faster just to give an idea. These kinds of things, right? Well, like a thank you. And
467
00:37:12,400 --> 00:37:17,120
here's some compensation. And then you could do with it, however you want. That's kind of the way
468
00:37:17,120 --> 00:37:22,640
I look at it least. Yeah, we do have some part time contractors as well. And I think that I think
469
00:37:22,640 --> 00:37:28,160
that it functions more like that for the part time contractors where they for whatever reason are
470
00:37:28,160 --> 00:37:32,720
not able or willing to go full time on zig or we don't have the funds to pay them. But they're
471
00:37:32,720 --> 00:37:37,120
able to do some side work, you know, part time and have a little bit of extra spending money at
472
00:37:37,120 --> 00:37:40,800
the same rate. I mean, how do you guys decide what's going to be the next release? I mean,
473
00:37:40,800 --> 00:37:44,640
if you said it sounds like people are really autonomous, but then there must be like a milestone
474
00:37:44,640 --> 00:37:48,080
listen on GitHub and then all the issues attached to it and people just kind of pop it off the stack
475
00:37:48,080 --> 00:37:52,480
whenever they feel like they want to work towards a new release. No. Yeah, so there's issues on there
476
00:37:52,480 --> 00:37:56,480
and that's to help the issues are to help coordinate between people. So that's what those are there
477
00:37:56,480 --> 00:38:02,960
for. I have a vision for what I think's important and I do my best to share and inspire, but I don't
478
00:38:02,960 --> 00:38:08,960
dictate. I mean, I do review code and I do veto technical decisions and I do guide the technical
479
00:38:08,960 --> 00:38:15,840
aspects of what is in scope of the project and what we're working towards. But I don't dictate the
480
00:38:15,840 --> 00:38:21,440
tasks of what people decide they want to work on. So as an example, we know that we want to have
481
00:38:22,160 --> 00:38:28,480
zig support for the major operating systems, Linux, Windows, Mac OS. We know that we want
482
00:38:28,480 --> 00:38:33,440
the self hosted compiler to have its own linker for these three operating systems for various
483
00:38:33,440 --> 00:38:42,400
reasons. Now, personally, my priorities would be like Windows x86, Linux x86, my priorities.
484
00:38:42,400 --> 00:38:47,440
Eventually, I'd want to get Mac OS to, but for Jakub, Mac OS is really important to him.
485
00:38:47,440 --> 00:38:51,920
And so that's what he's been focusing a lot of time on. And that's great. I'm happy about that.
486
00:38:51,920 --> 00:39:01,600
And thanks to that, we've had zig has a cross compiling across linker for Mac OS that other
487
00:39:01,600 --> 00:39:06,880
projects don't have access to. And if it were me, that's not what I would have prioritized my time
488
00:39:06,880 --> 00:39:12,160
on. But that's great. That is something that we want that's in scope. And I'm thrilled that
489
00:39:12,160 --> 00:39:16,000
that's something that Jakub is enthusiastic about. And then he's managed to push to this level of
490
00:39:16,000 --> 00:39:20,880
quality. That's great. As somebody who's an avid Mac user, let me make it clear the main reason I
491
00:39:20,880 --> 00:39:25,600
really want. Well, I like using Mac, the fits well for me. And it's like a kind of a major OS. But
492
00:39:25,600 --> 00:39:31,280
everything too, that I have to say, like in general, like I build iOS apps for some clients. And I
493
00:39:31,280 --> 00:39:35,440
just cannot do that. And otherwise, I mean, there are services I could use, but in general,
494
00:39:35,440 --> 00:39:39,920
like run the app and develop on my machine directly. So I'm kind of limited to that.
495
00:39:39,920 --> 00:39:44,080
So this makes sense for me to buy Mac. So for that, Mac OS support makes it more attractive for me,
496
00:39:44,080 --> 00:39:48,800
at least. Yeah, that makes sense. The new M1s are pretty nice. It's pretty nice machines.
497
00:39:48,800 --> 00:39:52,400
Yeah, we can go into M1 Ultra versus the other one. I've heard weird benchmarks for
498
00:39:52,400 --> 00:39:56,000
their basically about the same. So you may be paying extra for something, which is not
499
00:39:56,000 --> 00:40:00,240
great in terms of most tasks, maybe long running ones that might win out. But for some short-term
500
00:40:00,240 --> 00:40:05,680
ones, it doesn't really make sense. But yeah, okay, I think that's a good kind of overview,
501
00:40:05,680 --> 00:40:09,760
kind of going back. Okay, so you worked at Amazon. Obviously, I don't think you enjoyed your time
502
00:40:09,760 --> 00:40:15,840
there as you made it indirectly clear. But then what you're doing, and then of course, I think
503
00:40:15,840 --> 00:40:20,400
everybody knows that you were working at, what was that dating website? Okay, Cupid, right?
504
00:40:20,400 --> 00:40:24,080
Before it was actually called, okay, Cupid, but before, okay, Cupid, you think you also had
505
00:40:24,080 --> 00:40:28,240
some work you're doing too, right? Yeah, did a bunch of work at startups, worked at a couple
506
00:40:28,240 --> 00:40:34,320
music startups, worked at Backtrace. I think that's it. And where was it that, because I know
507
00:40:34,320 --> 00:40:38,640
before, okay, Cupid, you're working on Zig, right? Like, what was the motivating factor where you're
508
00:40:38,640 --> 00:40:42,640
like, okay, I want to build this thing? Were you working with Sea of the Time and you're just so
509
00:40:42,640 --> 00:40:47,120
frustrated by all these issues? Or was it just like you wanted to have fun? Or what was the
510
00:40:47,120 --> 00:40:53,920
motivating factor? Yeah, I was working on a digital audio workstation in C++. And yeah,
511
00:40:53,920 --> 00:40:58,240
running into a lot of issues. Actually, you know what, I tried a bunch of different languages
512
00:40:58,240 --> 00:41:02,960
for that project. I tried Go and I realized that it was not powerful enough, not low level enough.
513
00:41:02,960 --> 00:41:08,800
I tried, actually gave Rust a really solid shot for the digital audio workstation. And this was
514
00:41:08,800 --> 00:41:13,280
pretty 1.0. So with the caveat that I'm sure the experience is a lot smoother these days,
515
00:41:13,280 --> 00:41:19,920
back then I really struggled to be productive. The learning curve was very steep for me.
516
00:41:19,920 --> 00:41:25,360
I spent a month just trying to do some basic kind of like font rendering stuff for a GUI.
517
00:41:25,360 --> 00:41:31,840
And I mean, I got it working, but then I found that the way I built it didn't abstract properly.
518
00:41:31,840 --> 00:41:36,000
So it felt like even though I'd finally got it working, I couldn't even use my code.
519
00:41:36,000 --> 00:41:40,720
Didn't know how to build on it. Anyway, long story short, I had to be honest with myself.
520
00:41:40,720 --> 00:41:47,520
And I realized I am not productive with Rust. I am not making enough progress at a speed that
521
00:41:47,520 --> 00:41:53,440
is satisfactory to myself. So at that point, I switched to C++. And despite all of its flaws,
522
00:41:53,440 --> 00:41:58,480
I did experience a lot more productivity. And I was able to get a lot further in a shorter
523
00:41:58,480 --> 00:42:04,080
amount of time on the project with C++. But still, I mean, none of these things are
524
00:42:04,720 --> 00:42:10,480
were ideal for me. So at that point, I'd ping-ponged back for a bunch of different languages.
525
00:42:10,480 --> 00:42:17,600
And having had just compared all of them for this one use case, I had a pretty clear idea of
526
00:42:17,600 --> 00:42:22,480
what I wanted. And that's when I started Zig. How did you kind of prep yourself for writing a
527
00:42:22,480 --> 00:42:28,880
language? And that's a huge endeavor now. Yep. Step one is just get in it, get touch, read me,
528
00:42:28,880 --> 00:42:34,480
commit, then make a source directory. I mean, I'm just being facetious, but point being
529
00:42:34,800 --> 00:42:40,960
you just start, just go. The first thing I did was I tried to write a parser generator.
530
00:42:40,960 --> 00:42:45,840
Instead of using a parser generator, tried to make one. And a few weeks, I just gave up because
531
00:42:45,840 --> 00:42:50,080
that's way too hard. I was not able to do that. And I just started doing recursive descent. And
532
00:42:50,080 --> 00:42:56,080
that was way easier. It's just the first problem I ran into. So I don't know, you just start and
533
00:42:56,080 --> 00:42:59,760
then you run into problem after problem after problem. And if you don't give up, then eventually
534
00:42:59,760 --> 00:43:03,760
you have something. I think my biggest question is like, if you're coming from higher level
535
00:43:03,760 --> 00:43:09,040
languages, even if you did see in C++, like designing the language, I mean, there's a lot of things
536
00:43:09,040 --> 00:43:11,840
you need to know, a lot of things you need to consider, like, how does this stuff actually work?
537
00:43:11,840 --> 00:43:15,520
Like, if you want to know how to get to the bytecode, then LLVM, you could just kick out
538
00:43:15,520 --> 00:43:19,120
finally machine code at the end, right? Or binary code, whatever you want to call it,
539
00:43:19,120 --> 00:43:23,440
the final end product, right? But Zig is not using LLVM, right? Do you think something else or
540
00:43:23,440 --> 00:43:27,280
how does it actually work? You're characterizing me as coming from higher level languages, but I
541
00:43:27,280 --> 00:43:32,640
think that might not be accurate because, I mean, I had been using C++ even professionally for a
542
00:43:32,640 --> 00:43:39,120
while, and I had done a project where I recompile, aesthetically recompiled Nintendo games
543
00:43:39,120 --> 00:43:45,440
to native executables using LLVM. So, I mean, I was pretty familiar with a bunch of low level
544
00:43:45,440 --> 00:43:50,160
stuff. And for that project, I wrote a disassembler and assembler. I had to learn about JIT, I had to
545
00:43:50,160 --> 00:43:54,960
learn about a lot of stuff. So, I mean, I definitely was familiar with a lot of these topics. It wasn't
546
00:43:54,960 --> 00:43:59,840
just me going from high level languages and then making a low level language. Also, the
547
00:43:59,840 --> 00:44:04,800
to answer your question, the Zid compiler that everyone is using today is using LLVM.
548
00:44:04,800 --> 00:44:12,240
And the self-hosted compiler that is imminently shipping, it has a LLVM backend. It also has a
549
00:44:12,240 --> 00:44:17,680
C backend, a native x86 backend, a native ARM backend, a native WebAssembly backend,
550
00:44:17,680 --> 00:44:22,960
even a SpearV backend. These are all various levels of completion. The LLVM backend is the most
551
00:44:22,960 --> 00:44:28,080
complete. Oh, now I feel I've been embarrassed I didn't know so much about these details, but
552
00:44:28,080 --> 00:44:32,000
yeah, okay. Like I said, no worries. Yeah, no shade on you. I just wanted to make sure the
553
00:44:32,000 --> 00:44:36,800
listeners didn't think that I was a green language user when I started making Zig.
554
00:44:36,800 --> 00:44:40,960
No, and I think that's fine, right? I mean, nobody, like, when you started those pieces,
555
00:44:40,960 --> 00:44:43,920
right, you have pretty much no idea like, how do you actually learn them? Did you actually crack
556
00:44:43,920 --> 00:44:48,800
open a book and start reading or did you reading stuff online or I mean, I have no idea what like
557
00:44:48,800 --> 00:44:51,360
where you even would start to learn these kind of pieces and why?
558
00:44:51,360 --> 00:44:54,160
I just spent a lot of time practicing.
559
00:44:54,160 --> 00:44:59,280
And when I were chunks, right? Yeah. Well, at some point I moved out of my parents' house and I spent
560
00:44:59,280 --> 00:45:03,440
a lot more than one hour a day on the computer. Wait, wait, wait, was it similar to like, once you
561
00:45:03,440 --> 00:45:06,400
move out of your parents' house, you start eating ice cream all the time because there was nobody
562
00:45:06,400 --> 00:45:11,280
telling you not to? Yep, that's exactly right. I'm doing the kid who lives under our rock and
563
00:45:11,280 --> 00:45:17,280
then drinks too much alcohol in college except for computers. Karamazoo, that Amash TV show,
564
00:45:17,280 --> 00:45:20,880
I think I've seen the bits and pieces on TLC. Have you seen that one? No, I don't know what you're
565
00:45:20,880 --> 00:45:25,360
talking about. There's a show, I really haven't watched the whole episode but I've seen bits and
566
00:45:25,360 --> 00:45:29,280
pieces where these people who are Amash, I think they have like, when you're getting to just about
567
00:45:29,280 --> 00:45:33,520
being an adult in their community, you're allowed to kind of go out and have like a crazy wild weekend
568
00:45:33,520 --> 00:45:41,280
or day and they get to experience, you know, electricity, drinking, bikinis, you know, stuff
569
00:45:41,280 --> 00:45:44,720
that that's just not in the community and then they kind of come back and say, yeah, I think I
570
00:45:44,720 --> 00:45:47,920
want to stay, you know, here or they say, you know what, the world outside a little bit more
571
00:45:47,920 --> 00:45:53,200
interesting. That's what I understand, right? So don't take as my word. It's like the Amash purge.
572
00:45:53,200 --> 00:45:59,280
Yeah, something like that. So they actually videotape it on TLC and you're like, wow, these guys are
573
00:45:59,280 --> 00:46:03,200
wild but you know, like we've talked about before, hey, you know, if you never had a chance to go out
574
00:46:03,200 --> 00:46:06,880
and do things when you do get the opportunity, you may not be able to control yourself.
575
00:46:06,880 --> 00:46:13,200
Yeah, I don't know if that's real or not. Maybe it is but here we are. Yeah, so okay, it's good to
576
00:46:13,200 --> 00:46:17,760
hear it because I didn't know if you actually use LLVM or not because it wasn't clear for me.
577
00:46:17,760 --> 00:46:21,600
I know Russ definitely makes it clear and also I'm more in the community of Russ, I am with
578
00:46:21,600 --> 00:46:24,960
Zig. So it wasn't super clear to me that you guys are using that because I was like, hmm,
579
00:46:24,960 --> 00:46:28,640
how can you guys optimize and be faster than C but that's must be
580
00:46:28,640 --> 00:46:33,120
but we're talking about runtime performance, right? So that's related to the fact that it's
581
00:46:33,120 --> 00:46:40,800
using LLVM. Here's what I'll say. It's hard to beat LLVM's performance at runtime and it's hard
582
00:46:40,800 --> 00:46:46,880
not to beat LLVM's performance at compile time. Oh, okay, I see. Yeah, yeah. Well, that's one of
583
00:46:46,880 --> 00:46:49,920
the things that Russ is famous for now. So because you guys are using LLVM,
584
00:46:49,920 --> 00:46:55,040
is there also a slow compilation problem too because that's kind of also what Russ is known for
585
00:46:55,040 --> 00:46:59,840
but that may also be his borrow checker. If you look at the timings of a Zig compilation today,
586
00:46:59,840 --> 00:47:07,040
it's 90% waiting for LLVM but that's the thing though, so this new self-hosted compiler that we're
587
00:47:07,040 --> 00:47:12,560
shipping soon, it's going to ship with the LLVM backend. That's the first step but we have the
588
00:47:12,560 --> 00:47:19,920
x86 backend, what is it? 60% done or something like that. So when this one gets done, that's no LLVM.
589
00:47:19,920 --> 00:47:26,640
So what we're going to have is we're basically following in these footsteps, which is you have a
590
00:47:26,640 --> 00:47:33,360
pure self-hosted compiler for debug builds and the purpose of those is to go fast, compile fast,
591
00:47:33,360 --> 00:47:38,640
so you can have that quick iteration time, you know, edit compile test cycle. And then when you
592
00:47:38,640 --> 00:47:41,920
want to create your production build, then you're going to do a release build and you're going to
593
00:47:41,920 --> 00:47:46,640
use the LLVM backend for that. Take a little bit longer, get better results.
594
00:47:46,640 --> 00:47:52,480
Now I'm kind of curious, so why did you take LLVM over, say GCC? I mean, I always heard that GCC
595
00:47:52,480 --> 00:47:57,280
is really good but I think there's some issues with it. When I hear the difference between LLVM
596
00:47:57,280 --> 00:48:02,240
and GCC is that GCC is like all optimizations built into it because of history and LLVM is
597
00:48:02,240 --> 00:48:06,800
kind of catching up. And they're kind of neck and neck, there are some cases, one of them wins,
598
00:48:06,800 --> 00:48:13,280
some cases, the other one wins. The two reasons are license, LLVM has a liberal license, GCC has
599
00:48:13,280 --> 00:48:20,480
GPL, Zeg is MIT, so GCC license is just not compatible. And the other one is just older and
600
00:48:20,480 --> 00:48:26,960
craftier, so I mean, LLVM is already a behemoth and it already has its own craft, but GCC has more.
601
00:48:26,960 --> 00:48:31,040
Okay, yeah, because I know in Rust, like there's some people working on GCC support and there's a
602
00:48:31,040 --> 00:48:35,040
lot of people really interested in that. And like I said, what I told you is what I understood about
603
00:48:35,040 --> 00:48:40,480
GCC versus LLVM, but I don't know how true that is and what exactly why people are interested
604
00:48:40,480 --> 00:48:46,080
because you make it sound like LLVM is really much better in terms of licensing, of course,
605
00:48:46,080 --> 00:48:50,400
but performance you're saying is really similar. I'm saying it's similar, yeah, I don't know where
606
00:48:50,400 --> 00:48:55,440
we're at with one versus the other. I think Foronix has a bunch of comparison benchmarks. If you want
607
00:48:55,440 --> 00:49:00,080
to know the latest, you can probably find it there. Okay, the other thing I thought was very
608
00:49:00,080 --> 00:49:03,440
interesting, I want to kind of get back more in your career is that like you basically said, hey,
609
00:49:04,720 --> 00:49:07,920
I really don't want to work on Zig. I think right after you left, okay, Cupid, right,
610
00:49:07,920 --> 00:49:11,120
I think that's when you really want focusing full time or do you have one more thing before that,
611
00:49:11,120 --> 00:49:15,920
one more gig? I did quit. Okay, Cupid directly to go full time on Zig. Yeah.
612
00:49:15,920 --> 00:49:20,240
Okay, yeah, and you went full time on Zig and you actually did it really mathematically. I thought
613
00:49:20,240 --> 00:49:24,800
it was kind of interesting and makes a lot of sense. It's like, okay, now I have enough cash and the
614
00:49:24,800 --> 00:49:29,600
way things are going with donations, like I'm going to like get very close to being at rock bottom
615
00:49:29,600 --> 00:49:32,800
and then be able to start going up from there. Right. I thought that was super interesting and
616
00:49:32,800 --> 00:49:36,720
I'm happy. Yeah. You're very much a programmer and you're like very analytical about this,
617
00:49:36,720 --> 00:49:42,640
looking at like a graph, I guess, and everything. It was very stressful. My fiance was very supportive
618
00:49:42,640 --> 00:49:47,200
of me during that time. You know, you look at the data, but you kind of almost can't believe your
619
00:49:47,200 --> 00:49:51,920
eyes and helps to have that other person saying, yeah, the number is check out, you can quit your
620
00:49:51,920 --> 00:49:56,880
job and saying, okay, yeah, okay, I'm going to do it. Yeah, I mean, having a supportive essay was
621
00:49:56,880 --> 00:50:02,560
really helpful, right? I can imagine too many people that would be like standing by you, but
622
00:50:02,560 --> 00:50:07,040
yeah, I understand. I guess you must have really talked about your passion for this and then that
623
00:50:07,040 --> 00:50:10,800
was like the kind of the thing. It's okay, let's just do it. Let's have a try, right?
624
00:50:10,800 --> 00:50:14,880
Oh, you mean by way of kind of like convincing her to go along with it?
625
00:50:14,880 --> 00:50:18,720
I mean, it's not about convincing, right? It's like, hey, I really want to do this. And then I
626
00:50:18,720 --> 00:50:22,880
think that your passion alone should probably already convince them, hey, let's just give it a shot.
627
00:50:22,880 --> 00:50:26,720
Right? Yeah, that sounds about right. I don't think it's really much of convincing. It's just like,
628
00:50:26,720 --> 00:50:31,200
okay, I trust you and let's give it a try. Yeah. Did you also have to bring your data to and
629
00:50:31,200 --> 00:50:34,400
really justify all your use cases? Do you ever give her an elevator pitch and everything?
630
00:50:34,400 --> 00:50:40,240
Yeah, I think I'm the one who is a little more focused on making sure that crunching the numbers
631
00:50:40,240 --> 00:50:44,640
and make sure the bottom line is black. So I think ultimately I had to convince myself, I think.
632
00:50:44,640 --> 00:50:50,080
Okay, but I guess seeing that she's online, like, okay, this is really working out. I'm happy we did
633
00:50:50,080 --> 00:50:56,320
it. Oh, yeah. She said that I was just obviously having some sort of a crisis of every day,
634
00:50:56,320 --> 00:51:00,800
having to go to work when I wanted to not be going to work and working on this other thing.
635
00:51:00,800 --> 00:51:04,800
And it was just a, I don't know, there's a difference in someone in someone's aura,
636
00:51:04,800 --> 00:51:08,880
you know, when they're working on what they want to do with their life rather than, you know,
637
00:51:08,880 --> 00:51:13,040
being a wage slave. So obviously it's been nice. Yeah, I mean, when you work on something
638
00:51:13,040 --> 00:51:17,680
as you really want to work on, I can also justify this. I'm working longer hours, but I feel happier
639
00:51:17,680 --> 00:51:23,280
overall because I'm doing things that I actually want to do. So I totally understand. Yeah, yeah.
640
00:51:23,280 --> 00:51:27,760
Okay. Yeah, I mean, maybe we can kind of start to wrap up with some final points, right? So
641
00:51:28,400 --> 00:51:33,280
Zigg is going towards a hosted compiler. Is there any other kind of short term things that
642
00:51:33,280 --> 00:51:37,360
are going to be happening sometime soon? Short term. Yeah, well, I'll tell you what's happening
643
00:51:37,360 --> 00:51:44,960
in a couple of weeks, we're having the first ever zig meetup in Milan, Italy. So yeah, about,
644
00:51:44,960 --> 00:51:49,840
I don't know, 40 people, it looks like should be pretty fun. Yeah, I mean, people may
645
00:51:49,840 --> 00:51:55,040
laugh about 40 people, but we have a saying in Asia, at least in China, it's like, every,
646
00:51:55,040 --> 00:52:00,320
was a 1000 kilometer March starts with one step, right? So 40 people now, it could be
647
00:52:00,320 --> 00:52:06,160
triple that the next time I have no idea. Like I said, I do see there's a community for zig. And
648
00:52:06,160 --> 00:52:09,440
yeah, because people don't make it doesn't mean that people don't care. Well, this is the first
649
00:52:09,440 --> 00:52:13,440
one. So I mean, as far as I'm concerned, the smaller the better, right? Because I like more
650
00:52:13,440 --> 00:52:19,120
intimate gathering. So the way I see it is, I'm going to enjoy the smaller numbers while they last,
651
00:52:19,120 --> 00:52:22,880
because in the future, they're going to be much bigger and it's going to have to be a different
652
00:52:22,880 --> 00:52:27,600
affair, you know, everything too is that I'm sure you're finding out doing a conference is a whole
653
00:52:27,600 --> 00:52:31,840
different thing. I've never done it before, but I've talked to people about them. And it's a lot of
654
00:52:31,840 --> 00:52:37,440
work. Thankfully, I can thank Lawrence for that. Laurie Crow is doing all the setup. He lives in
655
00:52:37,440 --> 00:52:42,560
Milan and he's set up the room and organizing and doing all the stuff that I would find it very
656
00:52:42,560 --> 00:52:47,600
difficult to stay on top of. So all I have to do is show up, which is super nice for me.
657
00:52:47,600 --> 00:52:54,240
So please don't mess this one up, please. Right. Yeah. Exactly. I hope you don't feel too much
658
00:52:54,240 --> 00:52:57,840
pressure on that part. Right. It's always like that. It's like, it was Occam's razor is at the
659
00:52:57,840 --> 00:53:01,920
one where it's like something they can go wrong or something like that. You're thinking of Murphy's law.
660
00:53:01,920 --> 00:53:05,920
Sorry, Murphy's law. Yeah. Occam's razor is the one about like the most obvious answer is the one
661
00:53:05,920 --> 00:53:12,960
that's true or something I forgot now. Occam's razor is if your explanation includes unnecessary
662
00:53:12,960 --> 00:53:16,800
pieces of explanation, then just remove the unnecessary pieces because you don't need them.
663
00:53:17,680 --> 00:53:22,880
Yeah. There it is. Again, I'm still waking up as I told you this morning. It's 10 30 almost.
664
00:53:22,880 --> 00:53:28,160
So yeah, that's fair. You have some coffee there. Yeah. If I didn't have coffee, I think I would,
665
00:53:28,160 --> 00:53:34,000
I don't know if I were to be able to even live. It's like my lifeblood. Nice. Ask me what kind of tea
666
00:53:34,000 --> 00:53:39,440
I'm drinking. What kind of tea you're drinking? This tea is Ulong tea. It's thematic. Are you
667
00:53:39,440 --> 00:53:45,600
ready? It's called Iron Goddess of Mercy. There's a tea called Teep is Cantonese word for steel or
668
00:53:45,600 --> 00:53:50,080
no iron. So I'm wondering if that's the same one. I don't know. I just picked it because we're doing
669
00:53:50,080 --> 00:53:55,920
the Rust podcast. But Guinyam is like a famous like mythological person in the Chinese community.
670
00:53:55,920 --> 00:54:00,160
And also I think it's the same person who was like, there's also a woman in like the Indian
671
00:54:00,160 --> 00:54:03,760
stuff that changes shape. It's actually similar, right? The India and China, they have a lot of
672
00:54:03,760 --> 00:54:09,040
similarities with their mythology. That makes sense. They're next to each other. Also the British,
673
00:54:09,040 --> 00:54:13,680
right? They brought British, you know, Indians over to Hong Kong and then you know, Hong Kong,
674
00:54:13,680 --> 00:54:17,360
you know, they mix together, etc. Right. So a lot of this kind of stuff trading on that.
675
00:54:17,360 --> 00:54:21,440
That makes sense. But yeah, I mean, I would love to chat some more, but I do have
676
00:54:21,440 --> 00:54:26,160
something I need to do relatively soon. I appreciate your time. Maybe we can kind of wrap up with kind
677
00:54:26,160 --> 00:54:30,320
of some, maybe if you have some last minute kind of calls, you want to call people to calls to action.
678
00:54:30,320 --> 00:54:35,440
Maybe people come check out the language, contribute, go to the conference, anything.
679
00:54:35,440 --> 00:54:39,840
Let's see. We have under Rust audience members, right? They're all probably pretty happy using
680
00:54:39,840 --> 00:54:43,600
Rust. They're great. They don't need any calls to action. You know, if they feel inspired and they
681
00:54:43,600 --> 00:54:48,240
want to throw some donation money our way, that's always welcome. You can find a link on the homepage,
682
00:54:48,240 --> 00:54:53,200
ziggling.org. But it's all good, you know, we can all use the tools that work best for us.
683
00:54:53,200 --> 00:54:56,880
No problem. Yeah, I think my call to action is just give it a try, especially if you're like,
684
00:54:56,880 --> 00:55:00,400
you're struggling with SIG or you think that maybe Rust doesn't work for everything,
685
00:55:00,400 --> 00:55:04,560
I'm sorry, struggling with Rust, not struggling with SIG. Give it a try. Maybe you find a new love,
686
00:55:04,560 --> 00:55:09,120
right? You never know until you try. I never would have predicted I would be really into Rust as
687
00:55:09,120 --> 00:55:14,720
I am right now. So maybe if I do try Zig, maybe I have a Zig station station after this. I don't know.
688
00:55:14,720 --> 00:55:18,960
Zig station station. Yeah, you might have to come up with a new pun.
689
00:55:18,960 --> 00:55:22,080
I don't know. If you have any ideas, iguana, sauna.
690
00:55:22,080 --> 00:55:26,160
Why iguana? Is that the mask or iguana? Sorry. Yeah. It's like the Rust station, right? So
691
00:55:26,160 --> 00:55:30,480
ziguana. So is an iguana actually the mask out? I didn't actually see that.
692
00:55:30,480 --> 00:55:36,480
Yeah, there's a ziguana. So you can call it the ziguana sauna podcast. There you go. Done. It's a fork.
693
00:55:36,480 --> 00:55:42,000
Okay. All right. Take a look at that. All right. Again, thank you for your time.
694
00:55:42,000 --> 00:55:45,440
Maybe we'll have you back later on to talk more about what's going on with zig. I think
695
00:55:45,440 --> 00:55:49,360
I'm happy that can give us an explanation finally because I've been asking people and
696
00:55:49,360 --> 00:55:53,680
I haven't really gotten that. And you definitely give a very good outlook on it. And so hopefully
697
00:55:53,680 --> 00:55:58,880
this inspires people to take a look at it. And maybe you'll have 41 or 43 people come into Milan.
698
00:55:58,880 --> 00:56:05,200
Well, thank you for your time. Nice to meet you, Alan, and I hope you enjoy your coffee and the
699
00:56:05,200 --> 00:56:08,560
rest of your day. And enjoy your tea. All right. Hopefully it doesn't make you stay up too late
700
00:56:08,560 --> 00:56:12,800
tonight. It's nighttime for you, right? Yeah, no problem. Ulong tea is low caffeine.
701
00:56:12,800 --> 00:56:16,800
Okay. I'm gonna look you in that one. All right. Thanks again for your help.
702
00:56:16,800 --> 00:56:25,520
And I'll catch you again next time. Take care.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment