jiacai2050 / ideas

Think more
https://github.com/jiacai2050/ideas/issues
29 stars 2 forks source link

Full-Time Open Source With Andrew Kelley #55

Open jiacai2050 opened 1 year ago

jiacai2050 commented 1 year ago

https://corecursive.com/067-zig-with-andrew-kelley/

Note: This podcast is designed to be heard. If you are able, we strongly encourage you to listen to the audio, which includes emphasis that’s not on the page

Introduction

Adam: Today on Corecursive.

Andrew: Let me be clear about this. Commercially forking Zig is fine. It’s MIT-licensed like go for it. But what they did with the Fork was be very tricky about it, right? So, they actually deleted the license file, put their own license in it and made it look like you had to pay for the software. So, they were deceiving people. That was the problem with what they were doing.

Adam: Hello, and welcome to Corecursive. I’m Adam Gordon Bell. Each episode someone shares the story of a piece of software being built. Today’s show, How to Quit Your Job and Work on Open Source Full Time. This story has it all, balancing open source work and full-time employment, building up enough supporters and enough savings to leave your job. The hardest part to me which is explaining leaving your job to your significant other and to your family and friends.

And then, also what do you do if your project succeeds, and then someone forks it and builds a commercial business around it? There’s a lot more as well dealing with hacker news feedback, how to improve upon the C programming language and how to be super ambitious without seeming arrogant. And my guest is this guy.

Andrew: My name is Andrew Kelly. I am the lead software developer and president of the Zig Software Foundation.

The Music Studio Project

Adam: Zig is a programming language, and we’ll get into why it’s needed, but Andrew got started on Zig because of another side project.

Andrew: I started working on a music studio project, and in this music studio project, you have more difficult requirements than you usually have in other programming projects. So, for example, if anyone’s going to use your music studio software live, for live performance, you have a hot loop where you absolutely must not skip the audio or their entire performance might be compromised.

So, you just have these like new constraints where you really need control over how it’s going to work. And likewise, if you want to support all the hardware that’s associated with this, a lot of times you’re not going to be able to rely on someone else’s third-party library to do that for you, you’re going to have to get into OC, C++ or another low-level language that gives you the control that you need and the other thing I noticed is that when I tried to use other people’s libraries, if I ran into a problem, I wouldn’t be able to fix it. It’s too slow.

I’m trying to make progress on this big project and I learned the value of inventing stuff here, right? People are always telling you, “Don’t invent.” Don’t NIH syndrome, but I learned the value of actually, yeah, that is the right thing to do sometimes. If you really want that much power and control you got to do it. So, that’s when I started just really getting into programming stuff from scratch with C or C++.

Reuse Problems

Adam: Even in C reuse is common, but reuse can bring problems.

Andrew: I think that the natural first impulse was that if someone else solved the problem, just go use their solution, right? It’s already done. You write the glue code, and then you’re off. In a lot of ways that’s smart because we only have so much time, we only have so much ability to analyze a problem space. And the other person has already done that part. So, let’s see what’s a good example of this.

The audio library would be an example. So, I tried using port audio. I tried using SDL, I think. These projects mostly work, but then the problem is that they solve 90% of the problem, and if you want to close that last 10% gap, you have to start over. So, I ended up writing my own cross-platform audio abstraction called the libsound.io, and that allowed me to do things that the other libraries didn’t let me do. So, for example, I had the ability to just display a list of input devices and have it automatically refresh. If you unplug the mic, it goes away, if you plug the mic in, it shows up.

It seems so simple, seems like such a reasonable thing for the user experience, but these other libraries just did not have that ability. And it would have taken me probably honestly years to get the feature into those libraries, and then have enough time pass that those libraries got the updates into the various open source distributions of packaged libraries. Because if you use a third-party library, people want to use the pre-packaged versions. So, then you’re even waiting for their release cycle. And then, you’re waiting for the downstream maintainers to get it, but if you put it in your own code base, you just ship it when you want to ship it, right?

And there’s just so many problems with these languages that get in the way of progress, bugs take forever to find and fix, progress is slower than it should be. And so, that’s when the juices started flowing. And I thought, “I think I can do better than this.” I think I see what these languages are bringing to the table and I think I can take them to the next level.

Fighting the Impluse To Rewrite

Adam: Did you fight that impulse? Did you immediately get sidetracked on building a language or what happened there?

Andrew: I did. I did fight the impulse. And I stuck with the music player project for quite a while. And then, to be honest I just went through kind of a difficult life experience. It was a breakup at the time and just as kind of a coping mechanism I let myself say, “Hey, I know you’ve been trying to be just disciplined and stick with the same project for a long time, but go have some fun, start a new project, start a programming language. It’ll be good for you.” And then, it’s never switched back.

Adam: So, was it like you were like my whole mind is occupied by this breakup, but I think if I start this new project it might be able to squeeze it out of my brain at least temporarily?

Andrew: Yeah. That was exactly right.

Adam: And did it work?

Andrew: Mn-hmm (affirmative). I mean I think just the natural emotional progress ran its course, but just in the meantime I was having fun with a distracting toy project.

Adam: Yeah. I mean it’s certainly more productive than like, I don’t know, playing Mario Kart for-

Andrew: Mario Kart.

Adam: … eight hours a day or something. I like Mario Kart. I don’t know.

Andrew: Yeah. Mario Kart’s a great game.

Creating a Programming Language

Adam: Andrew had always wanted to create a programming language.

Andrew: The very first time I ever used a programming language, I always wondered what would it be like to make one? And whenever I listen to music, I always wonder what would it be like to try and make a song like this? I’ve always enjoyed just consuming things by just wondering what the other side of the process looks like.

Adam: When I was in university, I had a class where we built a compiler, like a toy compiler. And it was super fun. Andrew had a similar experience and went on to toy around with a fork of CoffeeScript. I found playing with programming languages to be fun, but Andrew, he got something different out of it.

Andrew: You know what it was? I actually ran my first marathon a couple years ago, but I don’t feel like I did. Because I walked the last four miles of it, hit that wall hard. And I guess most people do, because I was still in like the top 50% for my age group. So, I guess just most people walk at the end of marathons, but in my head, it’s like you didn’t do it. You walked part of it, right?

So, I always felt that way about the compilers that I’ve made, because if it’s like a CoffeeScript one, you’re actually just outputting JavaScript. And then, for the one in college the professor just had us do C as the output. So, I always felt like I walked the last part. I always wanted to say, “No. I want to make it actually make machine code and make it do the whole thing. I don’t want to cheat on some of the layers.”

I also don’t want to devalue like the work that people have done. That’s all it’s still a compiler. If you go from one input language to a different input language, that’s a compiler. That’s just my personal subjective experience is that I felt like I was missing some interesting part that I hadn’t had the experience of completing.

C Is Popular

Adam: Andrew understood before he even started what the C language brought to the table, and this is important. C is a small language and it’s everywhere. C is used by 20% of software developers according to the Stack Overflow Survey. Some conditions may apply there.

I don’t know if the Stack Overflow Survey is representative, but they have a lot of developers using it and 20% of them say that they are writing C. That’s one in five developers. That’s more people than use Ruby and Swift and Rust combined.

So, anyways, Andrew has his breakup and he gives himself permission to start on his language. His idea isn’t to start from first principles and create a new language, but to look for specific problems that can be addressed.

Andrew: Is there dirt under this rug? Maybe we can do this a different way. A lot of software is built on premises of abstractions that previous generations have handed to us. Let’s peel those off a little bit and take a peek and say, “Maybe we might want to make some different decisions now that it’s 40 years later.”

Static Linking

Adam: What’s an example?

Andrew: One example would be static linking. If you’re trying to ship a application on Linux, there’s a common problem people have where it’ll only work on one distribution of Linux. So, for example, someone might provide their application on their website you download it, but only runs on Ubuntu or something that’s close enough to Ubuntu.

Adam: I literally just had this problem. I was trying to install a Python library Matplotlib. And on Mac OS, it was super easy, but to get it into Alpine Linux, I had to install all these dependencies.

Andrew: And the reason for this is that they dynamic link all the libraries they depend on. They just expect you to install those libraries with the system package manager. I’ve chosen to make Zig so that the default on Linux is that you do not link libc at all when we provide the download of a pre-built Zig for Linux. It works for all Linuxes, all of them, because the binary has no libc dependency. It just uses the syscalls in assembly.

And the only dependency it has is a file system and the kernel. It doesn’t depend on anything else. So, that way we can provide a binary that just works for everybody’s computer on Linux just like on Windows and other systems. We got that benefit by questioning distributing things with dynamic linking and saying, “Well, maybe we should go a different direction.”

Adam: Go does something similar?

Integer Casting Rules

Andrew: Yes. I think it does depend on glibc though. I know that you can actually use Zig with Go and Zig will provide the ability to have a static Linux binary and give you this benefit with Go programs.

Adam: So, were there other aspects of C that you were targeting that frustrated you?

Andrew: One is that there are just too many ways to accidentally introduce bugs that are not interesting bugs that you get because programming is hard, but they’re unnecessary bugs, because the C programming language made some bad decisions. So, as an example, there’s a type system and the whole point of a type system is to help you not make bugs, but the type system has some things that it allows with no errors and no warnings that just are bugs 99% of the time.

It’s very easy to make that mistake. Just stuff like integer casting rules is one, so that’s one complaint I would make. Too easy to shoot yourself in the foot. And then, have a unnecessarily complicated debugging session to solve the problem.

The C Preprocessor

Andrew: And then, the second complaint I would make is that while C code is usually very simple to read, because it’s just functions and data. That’s the best case scenario. It does have just another different programming language on top of it, which is the C pre-processor. It’s not C, it’s a different language that’s based on text concatenation and people abuse that language too much.

And then, it’s just too hard to figure out what’s going on. You see a function call, is it a function call? If you’re not super familiar with the code you’re reading, you’re always wondering, “Is that a macro? It might be a macro.” Right?

Adam: Yeah. It requires global knowledge of what all of these things are.

Andrew: Global knowledge is a great way to put it. Yeah. One of the big design considerations that I made with the Zig language was let’s reduce the amount that someone must remember when they’re reading code.

Software Development Culture

Adam: Another thing Andrew thought he could improve upon was more cultural.

Andrew: Some people are so defensive about a norm where people are like mean to each other. And don’t get me wrong, I’m a very blunt person. I’m very comfortable with conflict and I can tell someone I think that they’re full of shit, but have you ever gone into the C, freenode channel and just observed?

Adam: No.

Andrew: That is one of the most toxic, hostile chatrooms I’ve ever been in. Before the freenode drama, the C programming language channel on freenode. You could go in there and ask some simple question like, “How do I… I don’t know. How do I align a field in a struct or something?” Some very reasonable question, and you’ll get one person who calls you a name, one person who says you can’t period, passive aggressive doesn’t explain it at all.

One person gives you just wrong information and the actual answer is that you can do it. It’s fine. And there’s some tricks you can do. It’s one of the worst places in the world. I don’t know what’s up with that. So, it’s like the one word I’d use to describe it is pedantic, right?

Adam: oh, yeah.

Andrew: And they even have, there’s even a flag and a C compiler that’s pedantic. And I always think like, “Oh, it’s the C chat room flag.”

Adam: With this vision in mind of a better language and a better less pedantic community and a working version of the language up on GitHub, Andrew starts to get some users.

Releasing the First Version Of Zig

Andrew: The number of people who file an issue per week has just gone up slowly over time. The number of people who wanted to help out, submit pull requests, which were up for grabs since the very beginning. It was always done in the open. It’s just slowly gone up over time.

One of the first projects that I got to see that someone did with Zig was the Pokemon rom randomizer project. So, they used Zig and made a set of command line tools to take the Game Boy roms that were Pokemon ones and just did some rom hacking. And then, gave you a new rom that you could then pop into an emulator and it would shuffle around all the, which graphs have which Pokemon and stuff.

Adam: Building a programming language is just a lot of work. You have to find time to keep pushing it forward.

Andrew: I would describe Zig as kind of like a flower growing in the cracks of the concrete of my career. When I started it I was taking a break from full-time work. And then, I needed a job. So, I got a job at a start-up called Backtrace, did that for a little bit, save some more money, quit, worked on Zig full-time for a few months. I interviewed with Apple, and they just flat out said, “You may not do that in your spare time.”

So, I said, “Fuck off then.” And now getting donations from Apple to the Zig Software Foundation, by the way.

Adam: That’s awesome.

Joining OKCupid

Andrew: Joined OKCupid, moonlighted Zig during that time.

Adam: Was there ever any tension? I imagine you’re at OKCupid or the other place. And I don’t know, is work building up or is there things to do? Do you constantly try to evangelize how great your language is to your co-workers until they get angry? What happened?

Andrew: Oh, yeah. When I joined OKCupid, I had to have a whole negotiation with the recruiter, because a lot of companies just put in the contract something like, “Anything you do in your spare time is owned, the IP is owned by the company.” It’s ridiculous. So, I just said, “You have to strike that from the contract. I’m going to own all the IP of everything I do in my spare time on my own equipment.”

And the guy was like, “Oh, no one asks for this. We don’t usually do this. I’ll see what I can do.” And I had to take a real like hard-line stance with him, eventually he caved. You have to protect your baby or someone’s going to take it away.

Adam: Yeah. That’s silly, right? And you know that they had no problem striking it, it’s just they didn’t want to go through the problem of like… He didn’t want to find out who to ask about that.

Andrew: Yeah. He was just like didn’t want to bother.

Adam: Yeah.

Andrew: True.

OK WebServer and Zig

Adam: But what about your actual co-workers, did they know you were working on Zig? Did you talk about it?

Andrew: Oh, yeah. I wasn’t shy about that. And I tried not to be annoying, but I couldn’t help if we were… If we had some problem in the code base, I couldn’t help point out like, “Well, in Zig if you wrote… The code would be written this way and this problem would have been a compiler error instead of a bug.”

In some ways I think it helped me design the compiler errors because I was just seeing the problems that we were hitting in practice.

Adam: What technologies were they using?

Andrew: At OKCupid, it’s a big C++ code base.

Adam: It’s kind of unexpected to me that it would be C++. I just assume all like SaaS stuff is, I don’t know, not C++.

Andrew: Yeah. So, the funny story there is that the company was founded, I don’t know, 15 years ago by Maxwell Krohn, and this other guy’s name. Their PhD thesis was called OK Web Server. And it was just like some… It had nothing to do with dating. It was just a way to do security on a C++ web service. And so, basically they did their research, and they thought, “Okay, now what? I guess we’ll start a company.”

So, OKCupid was actually named after the research paper OK Web Server.

Adam: That’s funny.

Andrew: Yeah.

Adam: Yeah. So, it’s like arbitrary that they use C++. Well, it’s actually arbitrary that they choose dating.

Andrew: Right. Exactly. Yeah.

Adam: Yeah. It was always going to be C++. They just didn’t know what.

The OKCupid Code Base

Andrew: The funny thing too is when you’re joining the company they just have you read the paper, because it’s still accurate about how the code base works.

Adam: I mean in some ways that’s great, because like most places have code bases that like, there’s not a single person that can explain the entirety of it, right?

Andrew: Yeah. I agree with you, although I will say just having splunked through a bunch of that old code, I could tell that the founders were just having a lot of fun and just experimenting a lot, just playing with stuff. I’m just like, “Who cares? We’re definitely going to exit from the startup and leave in four years. I don’t give a shit.” Right?

You can see it in their code. You can tell they’re just screwing around and they really don’t care about the longevity of… It was pretty… I feel like I have kind of like a parasocial relationship with the founders. I didn’t actually interact with them, but I interacted with their code. And I’m just like…

Adam: What does-

Andrew: Why did you do this to me?

Adam: Yeah. What does I don’t give a shit, I’m going to exit like C++ look like?

Andrew: There was a file that was both a Perl script and a C++ file, and to update it… It’s self-updating, so you run it with Perl and it edits itself, but then you’re supposed to… It’s for the C++ project. Does that make sense? It’s a polyglot file.

Adam: Oh, wow.

Andrew: So, the same file is a Perl program and it edits itself like a weird hack so that it could be parsed by both.

Adam: That’s amazing.

Andrew: It’s very cute.

The Stress of Two Jobs

Adam: Before you went full time, did you ever feel like this is too much to do this and my job?

Andrew: Oh, I was definitely stressed out. Yeah. My fiancée can tell you about some of the times I just kind of just showed up very, very stressed and just like unable to like be a good partner, but I never even considered quitting doing Zig stuff. The only thing I ever considered was quitting work. The thing that was causing me so much stress was the feeling that I was wasting my life just on this bullshit. Wasting my life just being a pawn in someone else’s just play to get money, whereas what I felt like I was doing with this open source project was more meaningful.

I mean we create our own meaning in life. I’m not here to judge what anyone wants to do with their life, if you want to make money go make money, but I don’t want to be a pawn in your gambit to make money. I want to do what I think is meaningful in my life, and for me a large part of that is just contributing as a collective to open source software. And I could tell as Zig was picking up more steam, I could tell that I was missing out on opportunities, because of the full-time work.

People who would become contributors were kind of just turned away because they didn’t get enough attention that I would have given them if I had more time or just the progress, the rate of progress didn’t match up to my ambitions of what I wanted it to be. I think I just became very, very aware of the opportunity cost I was paying by being employed for someone else. And that was rough. That was probably a low point in my life.

Setting Up Patreon for Zig

Adam: Fortunately, Andrew had a plan that he got from Alan Webster.

Andrew: So, that’s someone from the handmade community. I met him at Handmade Seattle, but I noticed that he was making a text editor, and he had a patreon, and he was getting something like 400 bucks a month or something like that. And that’s not enough to live on. That’s maybe enough for groceries for food for a month, but I thought like that’s progress, and that’s a big amount of money, even if I’m just going to try and save money, and then quit and then go back to work when I run out, that would help me delay, that helped me give me more runway.

So, I thought, “Maybe this can work.” So, I started just paying really close attention to everyone who did this kind of imitate them. And so, yeah, so, I did a patreon at first, and there was never a spike. It was always just like very, very slow growth. I started doing live coding streams. I started, I just put links to donate to me at the bottom of my blog posts. Every time I got a blog post on hacker news or Reddit or something I’d get like a few more donations, but the point is they’re recurring.

People are going to add and remove, it’s going to go up or down, but because of statistics you can just kind of count on it more. You can plan your life a little bit more about how much income you’re going to get. That was a total game changer. So, after a few months I realized that it was predictable. And I could actually find out how to quit my job. And then, that’s when I started crunching the numbers and figured out that if I quit and if my donation growth kept up that my savings would start, they’d dip, and then they start going back up before I hit zero.

Adam: Oh, that’s clever. Yeah. You calculated not just the amount you would need to survive, but how far you could dip into your savings before you’d come back out the rate of growth or something.

Andrew: Right. Yeah. With conservative numbers, but the math checked out. Yeah. It was really nerve-wracking and scary, but it turned out even much better than I expected, because the thing that I hadn’t considered is if I quit full-time work and I got to spend full-time work on Zig that would help me make more progress faster.

Telling Friends and Family I’m going Full-Time

Adam: Did you run this idea by others? Did you tell your mom, like, “Hey…”

Andrew: I told my girlfriend. She was really supportive, especially considering the fact that we were renting an apartment in Manhattan and she was still in school and wasn’t ready to start pulling a bunch of money in with her career yet. So, kudos to her for supporting my dream, even when it was like maybe not financially completely stable.

Adam: She was on board right away?

Andrew: Yeah. In fact, she actually encouraged me to do it. I think I was wavering a little bit, and she was the one who was saying, “I don’t know why you’re so worried. The numbers check out. I think you’re good.”

Adam: Was she the person you were afraid to run with this idea too? I just keep thinking of my mom.

Andrew: Your mom? What would you tell your mom?

Adam: She doesn’t really totally understand what I do at all, right? I think that it involves computers is the extent of it, right?

Andrew: Right.

Adam: So, telling her that I was going to leave my paying job that involves computers for a non-paying job that involves computers. I don’t think-

Andrew: Right. Yeah. I see the point that you’re making. Yeah. I think for me telling the older generation about this was all kind of fun and games to me. So, for example, my parents are pretty financially conservative. So, just telling my dad like, “Yeah, I’m quitting my job and going to do this like donation thing.” And being just completely… I don’t actually care what his feedback was, because I just, it’s not relevant.

But it was fun to just kind of make him think like, “Oh, what is my son doing? It doesn’t make any sense, but all right. I guess if it works for you.” And then, my girlfriend’s grandma was the other fun one. I recall she was saying something like, “So, what does he do? He has a tip jar.” It’s like close enough I guess.

Open Source Self Worth

Adam: That’s great. Once you did quit, was it everything that you thought it would be? Day one you start-

Andrew: It was even more. First of all, I’ve never been happier. Second of all, I realized that the freedom that I have has allowed me to open my mind up to just other, even just different politics and ways of thinking about society and how the world works. It’s harder to think about maybe more radical ways that society could run when you have to play the game, and you’re spending 40 or plus hours per week clocked in and just like doing the labor. Not only was it everything I thought I would be, but once I tasted this freedom, I know I will never have a boss again.

I will go start a farm if I have to. My just sense of worth of self-worth has just skyrocketed and I just, I don’t even want to be subject to another person’s domain anymore. I want everyone to feel this way. I want everyone to feel they get to decide what they do with their life and no one’s going to tell them what they have to do.

Adam: Did you have a really bad boss?

Andrew: Actually, no. Well, I did have one or two, but actually no. I’ve had bosses that are fine. I’ve had good bosses. I had a boss that was like a friend, a co-worker before who just kind of went into a manager position. I think that’s why I realized that I never want to have a boss again is that I had a good one and I still really hated him.

Adam: One thing Andrew hated in his work as a software laborer, which is what he calls it, was the presumption of growth and growing profit. So, to support Zig and to support himself and future contributors, he started the Zig Software Foundation, and he started it as a non-profit.

Andrew: So, all the income just comes from satisfied users. I mean the product is free. So, the point is we don’t have to grow. There’s no venture capitalists who are breathing down our back saying that we need to monetize our users. The motives that we have for doing features and making progress is just intrinsic. There’s no monetary incentives to do anything in Zig. It’s all just people driven.

And I think that to me that’s like I’m really happy with it being this way. And it’s something that I didn’t get when I worked at any startups.

Zig on Hacker News

Adam: Another thing he didn’t get to do when working at startups was show his work to the world, with Zig, everything was out in the open and early on Zig showed up on hacker news.

Andrew: A lot of the comments were, “Oh, we don’t need another programming language or this guy’s an idiot. He hasn’t even made a programming language before. This is like his first one.” Not actually true, but that people just say whatever they want to say. It was all just kind of like there’s too many players in the field. Just get out of here, shoo, that kind of thing.

And I wasn’t fazed at all. I was ready. I knew that was the game and just kept working on making progress in the language and just kept peeling off those layers and re-evaluating like, “What’s the better way to do this? How should the standard library work? How should the language work?” But I also did pay attention to the people who had legitimate complaints.

So, some of the early legitimate complaints were that the sigils were too noisy. We had percents everywhere. And they’re all gone now. I think that was a legitimate complaint and that it’s now gone. It looks like cleaner. It’s a lot more keyword based and it doesn’t seem to be an issue anymore.

Adam: Did you jump on when people said this is his first language or this can’t be trusted? Did you respond to them?

Andrew: I wasn’t shy, but I just kind of tried to only respond if I felt like I could like look good. What are you trying to do in a hacker news trend, right? You’re not actually interacting with someone. What you’re actually doing is putting on a show for the lurkers of which there’s like hundreds of thousands of lurkers. And those are the people who are going to read your comments and be like, “Oh, this guy’s cool. Maybe I want to actually check out the project.”

I was actually just trying to sell my personality at that point rather than engage with just people saying stupid shit.

Zig Is Immoral and UnSafe

Adam: In that first Zig post on hacker news, a lot of the comments were about the impossibility of replacing C, but Andrew hasn’t slowed down, and things being impossible is not the main thing that people bring up right now.

Andrew: It’s funny how it just kind of changes course as the language gets taken more and more seriously. And now, all the comments are even starting to shift to kind of like the philosophy of memory safety and whether Zig is immoral.

Adam: The morality comments they come from people who see Zig as competition to Rust, but Andrew doesn’t see it as competition.

Andrew: So, there’s a lot of ways that these languages can be complementary. And it doesn’t have to be like a zero-sum game, and there’s a lot of ways that these projects can help each other. So, as an example both projects depend on LLVM. So, on the Zig side of things, we’ve submitted a lot of bug fixes upstream to LLVM, especially regarding non x86 architectures, because we just have a really good cross compilation story. Likewise, Rust has submitted a lot of fixes to LLVM having to do with aliasing, because that’s just an important concept in that language.

It’s not as an important concept in C++, so that’s kind of the changes that they’ve made. So, in this way we can team up, right? That’s great. We’re on the same, we’re all just players in the open source field helping each other out. But there’s always people who want to make it a competition, which one’s better? Which one am I going to use? That sort of thing.

And so, people will just find ammo to fling. And so, the obvious one that you would pick is, “Well, Rust gives you memory safety and Zig doesn’t.” And the talking point is that’s a fatal flaw. It’s 2021, we can’t have memory on safety in a modern language. I think that they just kind of missed the point. So, the way I would describe it is that Rust has a kind of like vertical memory safety approach where on the top, it’s safe. And then, on the bottom, you hit the unsafe block, and it’s not safe, right?

Let’s acknowledge that Rust is also unsafe because it has unsafe blocks in it at the bottom layer. Zig is more of I would say horizontal safety approach. So, there’s no unsafe blocks where it’s all contained in, but each feature of the language models safety in a different way.

Pointers in Zig and Rust

Andrew: So, as an example, the pointer type in Zig actually can represent alignment. In Rust, if you want to mess with pointer alignment, you have to use an unsafe block and you’ve turned off safety for alignment.

In Zig, you have pointer alignment in the type. So, it’s actually completely safe, and in Rust it’s not.

Adam: Okay, pointers. This is a really cool example. So, pointers and C are just raw memory addresses. Just integers that tell you where to look in memory, and you can screw them up in a lot of ways. A pointer can be null. It can be incorrectly aligned and so on. Raw pointers leading to buffer overflows are responsible for many security problems, but pointers are also super useful. Certain system calls, you can’t make them without pointers.

So, Zig works to make pointers safer. It can’t be null. They have to be optional instead. They know about alignment and so on. Rust has a different strategy. Rust keeps pointers mainly the same as C, but it puts them in unsafe blocks and says, “You really shouldn’t be using these. We have the borrow checker. Zig could have taken this unsafe keyword approach.

Andrew: I mean if we did that, it would just kind of be Rust. I think this question is also asking why not add a borrow checker? And the answer is Zig also wants to be optimal and optimal means you want to fully use the hardware that you have. So, my hardware lets me use virtual memory and it lets me use intrusive data structures. And it lets me write code in a certain way that’s the most efficient way to use all the CPU and all the memory. So, if my language doesn’t let me use all my hardware features, it’s not optimal.

Undefined Behavior in Zig

Adam: Another way to think about this is Zig is less ambitious, intentionally. It’s a smaller language. It’s what if C were better? And one place you can see this is with the handling of undefined behavior.

Andrew: I think undefined behavior is a misunderstood beast. So, a lot of people think it’s just a crime like, “Why does it exist? It was a mistake to ever have it in the language.” But I think it’s actually a tool. I’ll give you an example. Integer overflow is a simple example.

So, you can define it so that if you overflow 64-bit integer, it wraps. That’s one way to do it. Now, you don’t have undefined behavior. Okay, but now if you add something in your code and it overflows, and you didn’t expect it to, now you have a bug. And this is a really contrived example, but let’s say it’s like the bank balance or something, and you just went from like a million dollars to zero or something like that.

That’s a critical bug that happened because of well-defined behavior, whereas if we make integer overflow for just the regular plus operator undefined, then we can compile the program in a safe mode that doesn’t allow it and crashes if it happens. And that’s what you get and debug and release safe builds of Zig.

So, my point is that undefined behavior lets you catch bugs. And also, let’s say that you had this code now and you’ve tested it. It’s battle tested. It’s done. It’s like some low-level library… No one’s reported a bug in it for 10 years. We’re done working on it, right? It’s finished. It’s like the mp3 encoder or something.

Now, you can compile it in a different mode and instead of putting a safety check in for the undefined behavior, now we tell the compiler, “Assume that will never happen, and now if it did happen it would be undefined behavior.” But because we know that there’s no bugs, we can actually generate much better code assuming that the undefined behavior will never happen.

Adam: So, in Zig, if you’re not doing the fastest build then you’re always asserting that this won’t overflow and you crash if that’s the case.

Andrew: Yeah. Exactly.

Adam: And that’s better than setting that person’s account to a million from a million to zero or whatever.

Andrew: That is in accordance with the Zig philosophy, yes.

Adam: If you’re running in your kind of release mode, you won’t crash on it, right?

Release Fast in Zig

Andrew: In release fast mode, which is unsafe, you will get actual undefined behavior. So, you might crash or you might get overflow. You might go down to zero or you might run an unrelated function.

Adam: Run an unrelated function. That sounds super scary. That’s why you don’t really want to turn off the asserts unless you’re certain that they’re not needed. I could see Andrew using this for the hot loop of his audio software, we’re missing the timing of the audio is almost as bad as crashing. The reason for being able to turn these off is for speed.

Andrew: And not only that, but by not having the checks, you’re allowing the optimizer to notice patterns that would not be there if the checks were present. So, for example, there may be the array bounds checking maybe is inside a function and by not including the checking, we were actually able to inline that function into the place of the call site. And then, because of the lack of bounds checking, it was then able to see another optimization and flatten that out. It can have snowballing effects to not have these extra checks in there.

Forking Zig

Adam: So, while Andrew is pushing Zig forward, trying to tell people that undefined behavior is a tool, not a crime, something bad happens.

Andrew: Oh, yeah, this story, huh? Yeah. We had this character come in, and at first, he just seemed a really enthusiastic contributor. He did a lot of help with his pull requests, but I didn’t mind. I would just kind of throw in a couple commits, some fix ups, and just merge it, and say, “Yeah, good enough. I’ll help you with the rest.”

But then all of a sudden, he just blew up at some kind of language decisions. He created a commercial fork, translated the documentation to Japanese, and then if you downloaded it, all the files were just the Zig files, but he just changed the extension to zen.

Adam: But he was a contributor to a certain extent?

Andrew: Oh, yeah.

Adam: It said in something I read that other contributors left with him.

Andrew: I think that’s not an accurate way to put it, because it implies that there was like some kind of controversy, but what actually happened was that just that one person… This guy’s name is [inaudible 00:37:20]. The thing that actually happened was that just he just got pissed and left and no one else left, but then he offered actual money to one of the core contributors of Zig, and that person accepted the job and started working on the fork.

So, that’s what happened. And you know what? Fair, because at that point, we didn’t have the Zig Software Foundation yet. We couldn’t offer any money to core contributors. You got to put food on your table, so I really… I don’t even blame them for taking it. They got to probably improve their resume and work on something more fun and get some more money. Fine.

Adam: So, were there people in Japan who are paying for a fork of Zig?

Andrew: I really don’t know. Honestly, this guy is a total weirdo. It’s like he’s the kind of person where they’ll share conspicuous photos of themselves, shaking hand with some important person. And then, you’re like, “What? What’s going on? What did you do with that person?” And it’s like, “Oh, we had like a business deal, business transaction.”

It’s like, “Well, what? What did you do?” And then, it’s all show. A super weirdo guy. I don’t even know how to explain it. I’m not giving you a good synopsis of the story, but let me be clear about this. Commercially forking Zig is fine. It’s MIT-licensed. Like go for it. You’re supposed to give, supposed to just acknowledge in the license that it’s a fork.

If you just take a file that’s Zig code, and you rename the extension, you have to keep the MIT license in there. That’s fine. Go for it. But what they did with the fork was like be very tricky about it, right? So, they actually deleted the license file, put their own license in it and made it look like you had to pay for the software. So, they put like, “Oh, this is licensed by our company’s license and you have to pay $100 a year or something for it.”

So, they were deceiving people. That was the problem with what they were doing. As long as you don’t trick people, you’re welcome to do a commercial fork of Zig.

Adam: Legally it’s fine to fork Zig. It’s allowed as part of the license, but it feels a bit wrong to me. Andrew built this and he deserves some credit for creating it, and if I were Andrew and I left my job to work full-time on this project. And now, had just been forked by a commercial company, I would have freaked out. Andrew is much more calm though.

Andrew: Honestly, it was more of a curiosity for me. I wasn’t ever worried about it, but I was definitely kind of just curious about, what is this guy’s motive? Didn’t seem like a effective strategy that he was taking.

Adam: The thing that strikes me as strange is like stealing something that’s free, and then trying to sell it. I guess that’s not totally what’s happening, but it’s sort of what’s happening.

Andrew: Yeah.

Adam: People don’t tend to pay for programming languages right now that often I guess.

Andrew: Right. Right.

Adam: I mean it’s possible that he was on to something.

Andrew: He was onto something in the sense that he translated the documentation, and then it became accessible to people who didn’t speak English. A lot of countries don’t have a big enough, like I don’t know cultural impact on the world that they can get away with not speaking English. So, in that way, English is one of the like lingua francas of technology for better or worse, but China, Japan, Russia are big enough that you can just be someone who only speaks those languages.

Adam: This language barrier is the heart of the issue, but the Zig team had a solution for that.

Andrew: We put out a little blog post just kind of explaining, “Hey, this other, this thing that you’re paying for, you can get it for free over here if you want. We’re sorry we don’t have the translation of the docs yet, hopefully we can get that soon.” And I think after that blog post… We got that blog post translated into Japanese. And I think that once people saw that and it went around they realized, “Oh, okay, it’s better to just get it from the upstream rather than go for this guy.”

The Opposite of Imposter Syndrome

Adam: It’s strange how this stuff, it doesn’t faze Andrew. Of course, I can improve upon C, of course, I could take on a commercial fork. People have talked to death the imposter syndrome, but this is the opposite. Andrew is just very assertive and confident in what he can accomplish.

Andrew: From the very beginning, my attitude was, “Let’s fucking do this. Let’s go. I’m not fooling around.” When you first make a project, obviously, you’re not unique, you’re not a unicorn. A lot of people made a programming language that’s not impressive, that’s not interesting. So, people are calling it a toy language at the very beginning.

And that’s good. I just let it slide. Part of the job I have to do is marketing and getting people to be excited about it. So, I know that having a reputation of a toy language in the beginning is okay and I’m not going to fight about it. But in my head I was thinking, “Oh, just wait. This ain’t no toy.”

Adam: That’s awesome. I love that. If you were going to run a marathon a lot of people have a goal to finish the marathon I guess, but you’re like, “I’m going to win it.”

Andrew: Yeah.

Adam: And take down C.

Andrew: Let’s go. Yeah.

Adam: Yeah.

Andrew: I do feel like I have a sense for like what’s cool and what’s kind of cringy. If your posts make it under Reddit or something. And so, I definitely have been very conscious about, how am I going to come off to people so that I don’t seem like too arrogant and too big for his britches or something even though I am?

Adam: Yeah. Because in the back of your head you’re like, “Yeah. We’re taking down C.” But you’re like, I’m just going to… Let’s get people slowly introduced to this concept.

Andrew: Yeah. Exactly.

The Future of Zig

Adam: What does the world look like when you take down C like?

Andrew: Oh, it’s beautiful. It looks mostly the same, except all your apps just work slightly better, and they just crash less often, and they use less memory, and they just go faster. When professors teach operating system courses, it’ll just be like obviously assumed that you just use Zig. That’s not the focus. That’s just the setting when textbooks try to do how operating systems work or how embedded devices work, it’ll just be like assumed that you’re going to use Zig as the example code, because that’s just what everyone does.

The world won’t really be that much different, it’ll just be just a better programming experience for everyone. So, in one sense I have a lot of ambition because I am trying to dethrone this entrenched player, but on the other sense, Zig is not actually a super ambitious language. It’s just trying to take it to the next level of faster, less memory, less bugs, better development experience, better end user experience. Just a little bit better.

Adam: So, it’s just an incremental improvement on C?

Andrew: Yep. So, that’s kind of the yin-yang of ambition there.

Adam: There’s no vision of you accepting your Turing award and… Yeah.

Andrew: No. Everyone will just be like a little less stressed in their daily lives as a programmer. That’s it.

Advice for Open Source Developers

Adam: Andrew is five years into building Zig and five years is a long time and Zig is more than just him now. The Zig Software Foundation is now supporting other full-time employees, and this is all through donations. Andrew has some tips for self-funding your own open source projects.

Andrew: I think that there’s no better time than now for people who’s trying to make a living in an unconventional way. My advice is do it because you love it and don’t be afraid to put yourself out there on the crowdfunding platforms and ask for tips and don’t expect overnight success. I also think that people do want a, they want something to believe in, right?

I think with early days of Zig the feeling that I was kind of offering was, we’re going to take on C, right? This is an ambitious project, but I’m here to stick with it. I’m here to pull it off. Let’s go. Let’s do this. And that was a vibe people can get on board with.

Let’s do this. Let’s go.

Putting Out My Tip Jar

Adam: That was the show. I find Andrew to be a very inspiring person. So, it’s time for me to put out my own tip jar. If you go to patreon.com/adamgordonbell, you can find the patreon page for the podcast, and if you are enjoying these episodes and want me to keep putting more time into them, think about setting up a recurring donation.

It takes me a lot of time to make each episode, and that’s why I’m only able to make one a month right now. So, if you want to support the show, check it out. I’ll put a link in the show notes and on the webpage as well.

Until next time, let’s do this. Let’s go or sorry. I mean thank you so much for listening.

Hello,
I make CoRecursive because I love it when someone shares the details behind some project, some bug, or some incident with me.

No other podcast was telling stories quite like I wanted to hear.

Right now this is all done by just me and I love doing it, but it's also exhausting.

Recommending the show to others and contributing to this patreon are the biggest things you can do to help out.

Whatever you can do to help, I truly appreciate it!

Thanks! Adam Gordon Bell

Support The Podcast

jiacai2050 commented 1 year ago

介绍

亚当:今天在 Corecursive 上。

安德鲁:让我说清楚这一点。商业上分叉 Zig 很好。它是麻省理工学院许可的,就像去争取它一样。但是他们对 Fork 所做的事情非常棘手,对吧?因此,他们实际上删除了许可证文件,将他们自己的许可证放入其中,并使它看起来像是您必须为该软件付费。所以,他们是在欺骗人们。这就是他们所做的事情的问题。

亚当:您好,欢迎来到 Corecursive。我是亚当·戈登·贝尔。每一集都有人分享正在构建的软件的故事。今天的节目,如何辞去工作并全职从事开源工作。这个故事说明了一切,平衡开源工作和全职工作,建立足够的支持者和足够的储蓄来离开你的工作。对我来说最困难的部分是解释将你的工作留给你的另一半以及你的家人和朋友。

然后,如果你的项目成功了,你会怎么做,然后有人分叉它并围绕它建立商业业务?处理黑客新闻反馈、如何改进 C 编程语言以及如何既雄心勃勃又不显得傲慢,还有很多其他内容。我的客人就是这个人。

安德鲁:我叫安德鲁·凯利。我是 Zig 软件基金会的首席软件开发人员和总裁。

音乐工作室项目

Adam: Zig 是一种编程语言,我们将探讨为什么需要它,但 Andrew 开始使用 Zig 是因为另一个副业项目。

安德鲁:我开始从事一个音乐工作室项目,在这个音乐工作室项目中,你的要求比通常在其他编程项目中的要求要高。因此,例如,如果有人要现场使用您的音乐工作室软件进行现场表演,您将遇到一个热循环,您绝对不能跳过音频,否则他们的整个表演可能会受到影响。

所以,你只有这些新的约束,你真的需要控制它的工作方式。同样,如果你想支持与此相关的所有硬件,很多时候你不能依赖别人的第三方库来为你做这件事,你将不得不进入 OC、C++ 或其他低级语言,让您获得所需的控制权,我注意到的另一件事是,当我尝试使用其他人的库时,如果遇到问题,我将无法修理它。太慢了。

我正努力在这个大项目上取得进展,我了解了在这里发明东西的价值,对吧?人们总是告诉你,“不要发明”。不要 NIH 综合症,但我学到了实际上的价值,是的,有时候这是正确的做法。如果你真的想要那么多的力量和控制力,你就必须去做。所以,那是我真正开始使用 C 或 C++ 从头开始编程的时候。

重用问题

Adam:即使在 C 语言中,重用也很常见,但重用也会带来问题。

安德鲁:我认为自然的第一个冲动是,如果其他人解决了问题,就去使用他们的解决方案,对吗?已经完成了。您编写胶水代码,然后就可以了。在很多方面这很聪明,因为我们只有这么多时间,我们只有这么多分析问题空间的能力。而另一个人已经完成了那部分。那么,让我们看看这方面的一个很好的例子。

音频库就是一个例子。所以,我尝试使用端口音频。我想我尝试过使用 SDL。这些项目大多有效,但问题是它们解决了 90% 的问题,如果你想缩小最后 10% 的差距,你必须重新开始。所以,我最终编写了自己的跨平台音频抽象,称为 libsound.io,这让我可以做其他库不允许我做的事情。因此,例如,我能够只显示输入设备列表并让它自动刷新。如果你拔掉麦克风,它就会消失,如果你插入麦克风,它就会出现。

这看起来很简单,对于用户体验来说似乎是一件很合理的事情,但是其他这些库却没有这种能力。老实说,我可能要花很多年才能将这些功能添加到这些库中,然后有足够的时间让这些库将更新更新到打包库的各种开源发行版中。因为如果你使用第三方库,人们希望使用预打包的版本。所以,你甚至在等待他们的发布周期。然后,你在等待下游的维护者得到它,但是如果你把它放在你自己的代码库中,你就在你想发布它的时候发布它,对吧?

这些语言存在太多阻碍进步的问题,错误需要很长时间才能找到并修复,进步比应有的慢。所以,那是果汁开始流动的时候。我想,“我想我可以做得更好。” 我想我看到了这些语言带来了什么,我想我可以将它们提升到一个新的水平。

与重写的冲动作斗争

亚当:你抗拒了那种冲动吗?您是否立即在构建语言或那里发生了什么事上偏离了方向?

安德鲁:我做到了。我确实抗拒了冲动。我坚持了很长一段时间的音乐播放器项目。然后,老实说,我刚刚经历了一段艰难的人生经历。当时是一次分手,就像一种应对机制,我让自己说,“嘿,我知道你一直在努力保持纪律并长期坚持同一个项目,但去享受一些乐趣吧,开始一个新项目,开始一种编程语言。这对你有好处。” 然后,它永远不会切换回来。

亚当:所以,你是不是觉得我的整个思绪都被这次分手占据了,但我想如果我开始这个新项目,它至少可以暂时把它从我的大脑中挤出来?

安德鲁:是的。这是完全正确的。

亚当:它奏效了吗?

安德鲁:嗯嗯(肯定的)。我的意思是,我认为只是自然的情感进展顺其自然,但就在与此同时,我正在玩一个分散注意力的玩具项目。

亚当:是的。我的意思是它肯定比我不知道的那样更有效率,玩马里奥卡丁车 -

安德鲁:马里奥卡丁车。

亚当: ……一天八小时左右。我喜欢马里奥卡丁车。我不知道。

安德鲁:是的。马里奥卡丁车是一款很棒的游戏。

创建编程语言

Adam: Andrew 一直想创建一种编程语言。

安德鲁:我第一次使用编程语言时,我总是想知道制作一个会是什么样子?每当我听音乐时,我总是想知道尝试制作这样一首歌会是什么感觉?我一直喜欢通过想知道过程的另一端是什么样子来消费东西。

亚当:当我在大学的时候,我有一堂课,我们构建了一个编译器,就像一个玩具编译器。这非常有趣。Andrew 也有过类似的经历,并继续研究 CoffeeScript 的分支。我发现玩编程语言很有趣,但是安德鲁,他从中得到了一些不同的东西。

安德鲁:你知道那是什么吗?事实上,我在几年前第一次跑完了马拉松,但我感觉自己没有跑过。因为我走了最后四英里,所以重重地撞到了那堵墙。而且我想大多数人都这样做,因为我仍然处于同龄人的前 50% 之列。所以,我想大多数人在马拉松比赛结束时都会步行,但在我看来,就像你没有做到一样。你走了一部分,对吧?

所以,我一直对我制作的编译器有这种感觉,因为如果它像 CoffeeScript 那样,你实际上只是在输出 JavaScript。然后,对于大学里的那个,教授只是让我们做 C 作为输出。所以,我总觉得自己走了最后一段。我一直想说:“不。我想让它真正地生成机器代码并让它完成所有事情。我不想在某些层面上作弊。”

我也不想像人们所做的工作那样贬值。仅此而已,它仍然是一个编译器。如果您从一种输入语言转到另一种输入语言,那就是编译器。这只是我个人的主观体验,我觉得我错过了一些我没有完成的有趣部分。

C 很受欢迎

Adam: Andrew 甚至在开始使用 C 语言之前就明白了,这很重要。C 是一种小型语言,它无处不在。根据 Stack Overflow 调查,20% 的软件开发人员使用 C。有些条件可能在那里适用。

我不知道 Stack Overflow 调查是否具有代表性,但他们有很多开发人员在使用它,其中 20% 的人说他们正在编写 C。这是五分之一的开发人员。这比使用 Ruby、Swift 和 Rust 的人加起来还多。

所以,无论如何,安德鲁分手了,他允许自己开始使用他的语言。他的想法不是从第一性原理开始创造一种新的语言,而是寻找可以解决的具体问题。

安德鲁:地毯下面有泥土吗?也许我们可以用不同的方式做到这一点。许多软件都是建立在前几代人交给我们的抽象前提之上的。让我们把它们剥开一点,看一眼然后说,“也许我们现在可能想要做出一些不同的决定,因为它已经 40 年了。”

静态链接

亚当:举个例子?

安德鲁:一个例子是静态链接。如果您尝试在 Linux 上发布应用程序,人们会遇到一个常见问题,即它只能在一种 Linux 发行版上运行。因此,例如,有人可能会在您下载它的网站上提供他们的应用程序,但只能在 Ubuntu 或与 Ubuntu 足够接近的东西上运行。

亚当:我确实遇到了这个问题。我试图安装一个 Python 库 Matplotlib。在 Mac OS 上,这非常简单,但要将其放入 Alpine Linux,我必须安装所有这些依赖项。

安德鲁:这样做的原因是他们动态链接他们依赖的所有库。他们只是希望您使用系统包管理器安装这些库。我选择制作 Zig,以便在 Linux 上的默认设置是当我们为 Linux 提供预构建的 Zig 下载时您根本不链接 libc。它适用于所有 Linux,所有这些,因为二进制文件没有 libc 依赖项。它只是在汇编中使用系统调用。

它唯一的依赖是文件系统和内核。它不依赖于任何其他东西。因此,通过这种方式,我们可以提供一个二进制文件,它只适用于 Linux 上的每个人的计算机,就像在 Windows 和其他系统上一样。我们通过质疑使用动态链接分发东西并说“好吧,也许我们应该走不同的方向”来获得好处。

Adam: Go 做类似的事情吗?

整数转换规则

安德鲁:是的。我认为它确实取决于 glibc。我知道您实际上可以将 Zig 与 Go 一起使用,并且 Zig 将提供拥有静态 Linux 二进制文件的能力,并通过 Go 程序为您提供这种好处。

Adam:那么,您所针对的 C 语言的其他方面是否让您感到沮丧?

Andrew:其中之一是有太多方法会意外引入错误,这些错误不是您因为编程困难而得到的有趣错误,但它们是不必要的错误,因为 C 编程语言做出了一些错误的决定。所以,作为一个例子,有一个类型系统,类型系统的全部意义在于帮助你不产生错误,但是类型系统有一些它允许的东西,没有错误,也没有警告,这只是 99% 的错误时间。

很容易犯这样的错误。就像整数转换规则这样的东西就是其中之一,所以这是我要抱怨的一个。太容易搬起石头砸自己的脚。然后,有一个不必要的复杂调试会话来解决问题。

C预处理器

Andrew:然后,我要提出的第二个抱怨是,虽然 C 代码通常非常易于阅读,因为它只是函数和数据。那是最好的情况。它上面确实有另一种不同的编程语言,即 C 预处理器。它不是 C,它是一种基于文本连接的不同语言,人们过度滥用该语言。

然后,很难弄清楚发生了什么。你看到一个函数调用,是函数调用吗?如果您对正在阅读的代码不是很熟悉,您总是会想,“那是一个宏吗?它可能是一个宏。” 正确的?

亚当:是的。它需要了解所有这些东西是什么的全球知识。

安德鲁:全球知识是一个很好的表达方式。是的。我对 Zig 语言所做的一项重大设计考虑是让我们减少人们在阅读代码时必须记住的数量。

软件开发文化

亚当:安德鲁认为他可以改进的另一件事是更具文化性。

安德鲁:有些人对人们彼此刻薄的规范非常防御。不要误会我的意思,我是一个非常直率的人。我对冲突感到很自在,我可以告诉别人我认为他们都是狗屎,但你有没有进入过 C、freenode 频道并只是观察?

亚当:没有。

安德鲁:那是我去过的最有毒、最敌对的聊天室之一。在 freenode 戏剧之前,freenode 上的 C 编程语言频道。你可以进去问一些简单的问题,比如,“我怎么……我不知道。我如何对齐结构中的字段或其他东西?” 一些非常合理的问题,你会得到一个叫你名字的人,一个说你不能句号的人,被动攻击根本无法解释。

一个人给了你错误的信息,而实际的答案是你可以做到。没关系。您可以使用一些技巧。这是世界上最糟糕的地方之一。我不知道那是怎么回事。所以,这就像我用来形容它的一个词是迂腐的,对吧?

亚当:哦,是的。

安德鲁:他们甚至有,甚至还有一个学究式的标志和 C 编译器。我总是这样想,“哦,这是 C 聊天室的旗帜。”

Adam:有了更好的语言和更少迂腐的更好社区以及 GitHub 上的语言工作版本的愿景,Andrew 开始获得一些用户。

发布 Zig 的第一个版本

安德鲁:每周提交问题的人数随着时间的推移缓慢上升。想要提供帮助、提交拉取请求的人数,这些请求从一开始就在争夺中。它总是在公开场合进行。它只是随着时间的推移慢慢上升。

我看到有人用 Zig 做的第一个项目是 Pokemon rom randomizer 项目。因此,他们使用 Zig 并制作了一套命令行工具来获取 Pokemon 的 Game Boy rom,并进行了一些 rom hacking。然后,给你一个新的 rom,然后你可以将它放入模拟器中,它会随机播放所有图形,其中包含 Pokemon 和其他东西。

Adam:构建编程语言需要大量工作。你必须找时间继续推动它前进。

安德鲁:我会把 Zig 描述成一种在我职业生涯的混凝土裂缝中生长的花朵。当我开始它时,我正从全职工作中休息一下。然后,我需要一份工作。所以,我在一家名为 Backtrace 的初创公司找到了一份工作,做了一段时间,存了更多的钱,然后辞职,全职在 Zig 工作了几个月。我采访了 Apple,他们直截了当地说,“你可能不会在业余时间这样做。”

所以,我说,“那就滚吧。” 顺便说一句,现在正在从 Apple 那里获得对 Zig Software Foundation 的捐款。

亚当:太棒了。

加入OKCupid

Andrew:加入 OKCupid,在那段时间兼职 Zig。

亚当:有过紧张吗?我想你在 OKCupid 或其他地方。我不知道,是工作在增加还是有事情要做?您是否不断尝试向同事宣扬您的语言有多棒,直到他们生气?发生了什么?

安德鲁:哦,是的。当我加入 OKCupid 时,我不得不与招聘人员进行整个谈判,因为很多公司只是在合同中写下这样的话,“你业余时间做的任何事情都归公司所有,IP 归公司所有。” 这太荒谬了。所以,我只是说,“你必须从合同中删除它。我将在业余时间在自己的设备上拥有所有的知识产权。”

那家伙就像,“哦,没有人要求这个。我们通常不这样做。我会看看我能做什么。” 而且我不得不对他采取真正的强硬立场,最终他屈服了。你必须保护你的孩子,否则有人会把它带走。

亚当:是的。这很愚蠢,对吧?而且你知道他们击中它没有问题,只是他们不想经历这样的问题……他不想找出问谁的问题。

安德鲁:是的。他就像不想打扰一样。

亚当:是的。

安德鲁:是的。

OK WebServer 和 Zig

Adam:但是你真正的同事呢,他们知道你在为 Zig 工作吗?你们谈过吗?

安德鲁:哦,是的。我对此并不害羞。我尽量不惹人讨厌,但如果我们是……如果我们在代码库中遇到问题,我会忍不住指出,“好吧,如果你在 Zig 中编写……代码将是以这种方式编写,这个问题将是编译器错误而不是错误。”

在某些方面,我认为它帮助我设计了编译器错误,因为我只是看到了我们在实践中遇到的问题。

亚当:他们使用了什么技术?

Andrew:在 OKCupid,这是一个很大的 C++ 代码库。

Adam:我有点没想到会是 C++。我只是假设所有像 SaaS 的东西,我不知道,不是 C++。

安德鲁:是的。所以,有趣的故事是,公司成立于 15 年前,我不知道,由 Maxwell Krohn,还有另一个人的名字。他们的博士论文名为 OK Web Server。它就像一些......它与约会无关。这只是一种在 C++ Web 服务上实现安全性的方法。所以,基本上他们做了研究,他们想,“好吧,现在呢?我想我们会开一家公司。”

所以,OKCupid 实际上是以研究论文 OK Web Server 命名的。

亚当:这很有趣。

安德鲁:是的。

亚当:是的。所以,他们使用 C++ 就像是任意的。好吧,他们选择约会实际上是任意的。

安德鲁:对。确切地。是的。

亚当:是的。它总是会是 C++。他们只是不知道是什么。

OKCupid 代码库

安德鲁:同样有趣的是,当你加入公司时,他们只让你阅读论文,因为它仍然准确地描述了代码库的工作方式。

亚当:我的意思是在某些方面这很棒,因为就像大多数地方都有喜欢的代码库一样,没有一个人可以解释全部,对吧?

安德鲁:是的。我同意你的看法,虽然我会说只是偷偷摸摸地浏览了一堆旧代码,但我可以看出创始人只是玩得很开心,只是在做很多实验,只是在玩东西。我就像,“谁在乎?我们肯定会退出这家初创公司,并在四年后离开。我才不在乎呢。” 正确的?

你可以在他们的代码中看到它。你可以看出他们只是在胡闹,他们真的不关心……的寿命。这很漂亮……我觉得我和创始人之间有一种类似社会关系的关系。我实际上并没有与他们互动,但我与他们的代码进行了互动。而我就像……

亚当:什么——

安德鲁:你为什么要这样对我?

亚当:是的。I don't give a shit, I'm going to exit like C++ 是什么意思?

Andrew:有一个文件既是 Perl 脚本又是 C++ 文件,要更新它……它是自我更新的,所以你用 Perl 运行它,它会自行编辑,但是你应该……它是为 C++ 准备的项目。那有意义吗?这是一个多语言文件。

亚当:哦,哇。

安德鲁:所以,同一个文件是一个 Perl 程序,它像一个奇怪的黑客一样编辑自己,以便两者都可以解析。

亚当:太棒了。

安德鲁:它很可爱。

两份工作的压力

亚当:在你全职工作之前,你有没有觉得做这件事和我的工作太过分了?

安德鲁:哦,我确实压力很大。是的。我的未婚妻可以告诉你,有些时候我只是表现得非常、非常有压力,就像无法成为一个好伙伴一样,但我从未考虑过放弃做 Zig 的事情。我唯一考虑过的事情就是辞职。让我压力如此之大的事情是我觉得我只是在胡说八道上浪费我的生命。浪费我的生命只是成为别人游戏中的棋子只是为了赚钱,而我觉得我在这个开源项目上做的事情更有意义。

我的意思是我们在生活中创造自己的意义。我不是来这里判断任何人想用他们的生活做什么,如果你想赚钱就去赚钱,但我不想成为你赚钱的棋子。我想做我认为对我的生活有意义的事情,对我来说,其中很大一部分只是作为一个集体为开源软件做出贡献。我看得出来,随着 Zig 的精力越来越旺盛,我看得出来我错过了很多机会,因为全职工作。

那些将成为贡献者的人有点被拒之门外,因为他们没有得到足够的关注,如果我有更多时间或只是进步,我会给予他们足够的关注,进步的速度与我的抱负不符想要它是。我想我只是变得非常、非常清楚我为别人工作所付出的机会成本。那很艰难。那可能是我人生中的一个低谷。

为 Zig 设置 Patreon

Adam:幸运的是,Andrew 从 Alan Webster 那里得到了一个计划。

安德鲁:所以,那是来自手工社区的人。我在 Handmade Seattle 遇到了他,但我注意到他在做一个文本编辑器,他有一个 patreon,他每月能拿到 400 美元左右的收入。这还不足以维持生计。这可能足够买一个月的食物了,但我认为这是进步,那是一大笔钱,即使我只是想省钱,然后辞职,等我回去工作时用完了,这会帮助我延迟,这会帮助我给我更多的跑道。

所以,我想,“也许这行得通。” 所以,我开始非常密切地关注每一个模仿他们的人。所以,是的,所以,我一开始做了一个 patreon,但从来没有出现峰值。它总是非常非常缓慢的增长。我开始做实时编码流。我开始了,我只是把捐赠给我的链接放在我的博客文章的底部。每次我收到一篇关于黑客新闻或 Reddit 或其他内容的博客文章时,我都会得到更多的捐款,但关键是它们是经常性的。

人们会添加和删除,它会上升或下降,但由于统计数据,您可以更加依赖它。您可以更多地计划您的生活,了解您将获得多少收入。那是一个彻底的游戏规则改变者。所以,几个月后,我意识到这是可以预见的。我实际上可以找到如何辞去工作的方法。然后,就在那时,我开始计算数字,发现如果我退出,如果我的捐款增长保持下去,我的储蓄就会开始,它们会下降,然后在我达到零之前开始回升。

亚当:哦,那很聪明。是的。您不仅计算了生存所需的金额,还计算了在恢复增长率或其他东西之前可以动用多少储蓄。

安德鲁:对。是的。使用保守的数字,但数学检查出来了。是的。这真的很伤脑筋也很可怕,但结果比我预期的要好得多,因为我没有考虑过的是,如果我辞掉全职工作,全职工作在 Zig 上,那会帮助我更快地取得更大的进步。

告诉朋友和家人我要全职

亚当:你有没有让别人运行这个想法?你有没有告诉你妈妈,比如,“嘿……”

安德鲁:我告诉了我的女朋友。她真的很支持我,尤其是考虑到我们在曼哈顿租了一套公寓,而她还在上学,还没有准备好开始在她的职业生涯中赚大钱。所以,感谢她支持我的梦想,即使在经济上可能还不太稳定的时候。

亚当:她马上就上船了?

安德鲁:是的。事实上,她实际上鼓励我这样做。我想我有点犹豫,她就是那个说,“我不知道你为什么这么担心。数字查出来了。我觉得你很好。”

亚当:她也是你害怕接受这个想法的人吗?我只是一直想着我的妈妈。

安德鲁:你妈妈?你会告诉你妈妈什么?

亚当:她根本不完全理解我的所作所为,对吧?我想涉及到计算机的程度吧?

安德鲁:对。

亚当:所以,告诉她我要离开涉及计算机的有薪工作,从事与计算机有关的无薪工作。我不认为-

安德鲁:对。是的。我明白你的意思了。是的。我认为对我来说,告诉老一辈这件事对我来说是一种乐趣和游戏。因此,例如,我的父母在经济上相当保守。所以,只是告诉我爸爸,“是的,我要辞掉工作,去做这件事,比如捐赠。” 并且完全......我实际上并不关心他的反馈是什么,因为我只是,它不相关。

但是让他这样想很有趣,“哦,我儿子在做什么?这没有任何意义,但没关系。我猜它是否适合你。” 然后,我女朋友的奶奶是另一个有趣的人。我记得她说了类似的话,“那么,他是做什么的?他有一个小费罐。” 我想这已经足够接近了。

开源自我价值

亚当:太好了。一旦你真的戒掉了,它是你想象的一切吗?第一天你开始-

安德鲁:甚至更多。首先,我从未如此快乐过。其次,我意识到我所拥有的自由让我能够敞开心扉去接受其他的,甚至只是不同的政治和思考社会以及世界运作方式的方式。当你必须玩游戏时,很难想出更激进的社会运行方式,而且你每周要花 40 个小时或更多时间上班,就像做劳动一样。这不仅是我想做的一切,而且一旦我尝到了这种自由的滋味,我就知道我再也不会有老板了。

如果必须的话,我会去开农场。我的自我价值感刚刚飙升,我只是,我什至不想再受制于另一个人的领域。我希望每个人都有这种感觉。我希望每个人都觉得他们可以决定自己的生活,没有人会告诉他们必须做什么。

亚当:你有一个非常糟糕的老板吗?

安德鲁:实际上,没有。好吧,我确实有一两个,但实际上没有。我有过很好的老板。我有过好老板。我有一个像朋友、同事一样的老板,他之前只是担任经理一职。我想这就是为什么我意识到我再也不想有老板了,因为我有一个好老板,但我仍然真的很讨厌他。

亚当:安德鲁在作为一名软件工人的工作中讨厌的一件事,就是他所说的增长和利润增长的假设。因此,为了支持 Zig 并支持他自己和未来的贡献者,他创立了 Zig 软件基金会,并且是作为一个非营利组织开始的。

安德鲁:所以,所有的收入都来自满意的用户。我的意思是产品是免费的。所以,关键是我们不必成长。没有风险资本家在我们背后说我们需要通过用户获利。我们做特色和取得进步的动机只是内在的。在 Zig 做任何事情都没有金钱激励。一切都是由人驱动的。

我认为这对我来说就像我真的很高兴这样。这是我在任何初创公司工作时都没有得到的东西。

Zig on 黑客新闻

Adam:他在初创公司工作时没有做的另一件事是向世界展示他的作品,对于 Zig,一切都是公开的,Zig 早期出现在黑客新闻上。

Andrew:很多评论是,“哦,我们不需要另一种编程语言,否则这家伙就是个白痴。他以前甚至没有制作过编程语言。这就像他的第一个。” 事实并非如此,但人们只是想说什么就说什么。这一切就像这个领域的球员太多了。离开这里,嘘,那种事。

我一点也不担心。我准备好了。我知道这就是游戏,我只是继续努力在语言方面取得进步,只是不断剥离这些层并重新评估,“做这件事的更好方法是什么?标准库应该如何工作?语言应该如何运作?” 但我也确实关注了有合理投诉的人。

因此,一些早期合理的抱怨是印记太吵了。我们到处都有百分比。现在他们都走了。我认为这是一个合理的投诉,现在已经消失了。它看起来更干净。它更多地基于关键字,它似乎不再是一个问题。

亚当:当人们说这是他的第一语言或这不可信时,你是否会欣然接受?你回应他们了吗?

安德鲁:我并不害羞,但我只是试着只在我觉得自己看起来不错时才做出回应。你想在黑客新闻趋势中做什么,对吗?您实际上并没有与某人互动。你实际上在做的是为潜伏者表演,其中有成千上万的潜伏者。那些人会读到你的评论,然后说,“哦,这家伙很酷。也许我想真正检查一下这个项目。”

那时我实际上只是想出卖我的个性,而不是只和那些说傻话的人打交道。

Zig 是不道德和不安全的

Adam:在 Zig 关于 hacker news 的第一篇文章中,很多评论都是关于不可能替换 C 的,但是 Andrew 并没有放慢脚步,不可能的事情并不是人们现在提出的主要问题。

安德鲁:有趣的是,随着语言越来越受到重视,它只是改变了方向。而现在,所有的评论甚至开始转向内存安全哲学和 Zig 是否不道德。

Adam:他们的道德评论来自将 Zig 视为 Rust 的竞争者,但 Andrew 并不认为它是竞争。

Andrew:因此,这些语言可以通过多种方式进行互补。而且它不一定像零和游戏,这些项目可以通过很多方式互相帮助。因此,作为示例,这两个项目都依赖于 LLVM。因此,在 Zig 方面,我们已经向 LLVM 上游提交了很多错误修复,特别是关于非 x86 架构,因为我们有一个非常好的交叉编译故事。同样,Rust 已经向 LLVM 提交了很多与别名有关的修复,因为这只是该语言中的一个重要概念。

它在 C++ 中不是一个重要的概念,所以这就是他们所做的改变。那么,这样我们就可以组队了,对吧?那太棒了。我们是一样的,我们都是开源领域的参与者,互相帮助。但是总有人想把它做成比赛,哪个更好?我要使用哪一个?之类的东西。

因此,人们只会找到弹药来投掷。因此,您最明显的选择是,“好吧,Rust 为您提供内存安全,而 Zig 没有。” 谈话要点是这是一个致命的缺陷。现在是 2021 年,我们无法用现代语言来记忆安全。我认为他们只是错过了重点。所以,我要描述的方式是 Rust 有一种类似于垂直内存安全的方法,在顶部,它是安全的。然后,在底部,你碰到了不安全的块,它不安全,对吧?

让我们承认 Rust 也是不安全的,因为它在底层有不安全的块。Zig 更像是水平安全方法。因此,没有不安全的块包含所有内容,但语言的每个功能都以不同的方式为安全建模。

Zig 和 Rust 中的指针

Andrew:所以,举个例子,Zig 中的指针类型实际上可以表示对齐。在 Rust 中,如果你想弄乱指针对齐,你必须使用一个不安全的块并且你已经关闭了对齐的安全性。

在 Zig 中,类型中有指针对齐。所以,它实际上是完全安全的,而在 Rust 中则不然。

亚当:好的,指点。这是一个非常酷的例子。所以,指针和 C 只是原始内存地址。只是告诉您在内存中查找位置的整数,您可以通过多种方式搞砸它们。指针可以为空。它可能没有正确对齐等等。导致缓冲区溢出的原始指针是造成许多安全问题的原因,但指针也非常有用。某些系统调用,没有指针就无法进行。

因此,Zig 致力于使指针更安全。它不能为空。它们必须是可选的。他们知道对齐等等。Rust 有不同的策略。Rust 保持指针主要与 C 相同,但它将它们放在不安全的块中并说,“你真的不应该使用它们。我们有借阅检查员。Zig 可以采用这种不安全的关键字方法。

安德鲁:我的意思是,如果我们这样做,它就会变成 Rust。我认为这个问题也在问为什么不添加一个借用检查器?答案是 Zig 也想做到最优,而最优意味着你想充分利用你拥有的硬件。所以,我的硬件允许我使用虚拟内存,它允许我使用侵入式数据结构。它让我以某种方式编写代码,这是使用所有 CPU 和所有内存的最有效方式。因此,如果我的语言不允许我使用所有硬件功能,那它就不是最佳选择。

Zig 中的未定义行为

Adam:另一种思考方式是,Zig 有意不那么雄心勃勃。这是一种更小的语言。如果C更好呢?您可以看到这一点的一个地方是对未定义行为的处理。

安德鲁:我认为未定义的行为是一种被误解的野兽。所以,很多人认为这只是一种犯罪,“它为什么存在?在语言中使用它是一个错误。” 但我认为它实际上是一种工具。我给你举个例子。整数溢出是一个简单的例子。

所以,你可以定义它,这样如果你溢出 64 位整数,它就会换行。这是一种方法。现在,您没有未定义的行为。好的,但是现在如果您在代码中添加了一些东西并且它溢出了,而您没有预料到它会溢出,那么现在您有一个错误。这是一个非常人为的例子,但假设它就像银行余额之类的东西,你只是从一百万美元变成了零或类似的东西。

这是由于明确定义的行为而发生的严重错误,而如果我们只为未定义的常规加运算符设置整数溢出,那么我们可以在不允许它发生的安全模式下编译程序,如果它发生则崩溃。这就是您得到的,调试和发布 Zig 的安全版本。

所以,我的观点是,未定义的行为可以让您捕获错误。而且,假设您现在拥有此代码并且已经对其进行了测试。它经过了战斗测试。完成。它就像一些低级库……10 年来没有人报告过其中的错误。我们已经完成了,对吧?都结束了。就像 mp3 编码器之类的。

现在,您可以在不同的模式下编译它,而不是对未定义的行为进行安全检查,现在我们告诉编译器,“假设这永远不会发生,现在如果它真的发生了,那将是未定义的行为。” 但是因为我们知道没有错误,我们实际上可以生成更好的代码,假设未定义的行为永远不会发生。

Adam:所以,在 Zig 中,如果您没有进行最快的构建,那么您总是断言这不会溢出,如果是这种情况,您就会崩溃。

安德鲁:是的。确切地。

亚当:这比将那个人的帐户设置为一百万从一百万到零或其他任何东西要好。

安德鲁:这符合 Zig 哲学,是的。

Adam:如果你在你的发布模式下运行,你就不会崩溃,对吧?

在 Zig 中快速发布

Andrew:在不安全的快速发布模式下,你会得到实际的未定义行为。所以,你可能会崩溃或者你可能会溢出。您可能会下降到零,或者您可能会运行不相关的功能。

Adam:运行一个不相关的函数。这听起来超级可怕。这就是为什么您真的不想关闭断言,除非您确定不需要它们。我可以看到安德鲁在他的音频软件的热循环中使用这个,我们错过了音频的时间几乎和崩溃一样糟糕。能够关闭这些的原因是为了速度。

Andrew:不仅如此,通过不进行检查,您还允许优化器注意到如果存在检查则不会存在的模式。因此,例如,可能有数组边界检查可能在函数内部,并且通过不包括检查,我们实际上能够将该函数内联到调用站点的位置。然后,由于缺乏边界检查,它能够看到另一个优化并将其展平。如果那里没有这些额外的检查,它可能会产生滚雪球效应。

分叉之字形

Adam:所以,当 Andrew 推动 Zig 前进,试图告诉人们未定义行为是一种工具,而不是犯罪时,不好的事情发生了。

安德鲁:哦,是的,这个故事,嗯?是的。我们让这个角色进来了,起初,他似乎是一个非常热情的贡献者。他对他的拉取请求提供了很多帮助,但我不介意。我只会投入一些提交,一些修复,然后合并它,然后说,“是的,足够好。剩下的我来帮你。”

但突然间,他对某种语言决定大发雷霆。他创建了一个商业分支,将文档翻译成日语,然后如果您下载它,所有文件都只是 Zig 文件,但他只是将扩展名更改为 zen。

亚当:但他在某种程度上是一个贡献者?

安德鲁:哦,是的。

亚当:在我读到的一些东西中说,其他贡献者和他一起离开了。

安德鲁:我认为这不是一种准确的表达方式,因为这意味着存在某种争议,但实际发生的只是那个人……这个人的名字是 [听不清 00:37:20]。实际发生的事情是,他只是生气并离开了,没有其他人离开,但后来他向 Zig 的核心贡献者之一提供了实际的资金,那个人接受了这份工作并开始在分叉上工作。

所以,这就是发生的事情。你知道吗?公平,因为那时我们还没有 Zig Software Foundation。我们无法向核心贡献者提供任何资金。你必须把食物放在你的桌子上,所以我真的……我什至不怪他们拿走它。他们可能必须改进自己的简历,从事更有趣的工作,并获得更多的钱。美好的。

亚当:那么,日本有没有人花钱买 Zig 的叉子?

安德鲁:我真的不知道。老实说,这家伙是个彻头彻尾的怪人。就好像他是那种他们会分享自己显眼的照片,与某个重要人物握手的人。然后,你就像,“什么?这是怎么回事?你对那个人做了什么?” 就像,“哦,我们有一个商业交易,商业交易。”

就像,“嗯,什么?你做了什么?” 然后,这一切都在表演。一个超级怪人。我什至不知道如何解释。我不会给你一个很好的故事梗概,但让我澄清一下。商业上分叉 Zig 很好。它是麻省理工学院许可的。喜欢去吧。你应该给予,应该只是在许可证中承认它是一个叉子。

如果你只是拿一个 Zig 代码的文件,然后重命名扩展名,你必须在那里保留 MIT 许可证。没关系。大胆试试吧。但是他们用叉子做的事情就像是非常棘手,对吧?因此,他们实际上删除了许可证文件,将他们自己的许可证放入其中,并使它看起来像是您必须为该软件付费。所以,他们说,“哦,这是我们公司的许可证,你必须每年支付 100 美元左右的费用。”

所以,他们是在欺骗人们。这就是他们所做的事情的问题。只要你不骗人,欢迎你做 Zig 的商业分支。

Adam:从法律上讲,分叉 Zig 是可以的。它被允许作为许可证的一部分,但我觉得有点不对劲。安德鲁建造了这个,他应该为创造它而受到一些赞扬,如果我是安德鲁,我就会辞掉工作全职从事这个项目。而现在,刚刚被一家商业公司分叉出来,我会吓坏的。不过安德鲁要冷静得多。

安德鲁:老实说,这对我来说更像是一种好奇心。我从来没有担心过,但我确实有点好奇,这家伙的动机是什么?他采取的策略似乎并不有效。

亚当:让我感到奇怪的事情就像偷了一些免费的东西,然后试图卖掉它。我想这不完全是正在发生的事情,但它是正在发生的事情。

安德鲁:是的。

Adam:人们现在并不像我猜的那样经常为编程语言付费。

安德鲁:对。正确的。

亚当:我的意思是他有可能在做某事。

安德鲁:从某种意义上说,他正在做一些事情,他翻译了文档,然后不会说英语的人也可以访问它。很多国家的影响力不够大,比如我不知道他们不说英语也能逃脱对世界的文化影响。因此,从这个意义上说,无论好坏,英语都是技术的通用语言之一,但中国、日本、俄罗斯足够大,你只能成为只会说这些语言的人。

Adam:语言障碍是问题的核心,但 Zig 团队有解决方案。

安德鲁:我们发表了一篇小博文,只是解释说,“嘿,这个,这个你付钱买的东西,如果你愿意,你可以在这里免费得到它。很抱歉,我们还没有文档的翻译,希望我们能尽快得到。” 我想在那篇博文之后……我们把那篇博文翻译成了日语。而且我认为,一旦人们看到它并且它四处传播,他们就会意识到,“哦,好吧,最好从上游得到它而不是去找这个人。”

冒名顶替综合症的对立面

亚当:奇怪的是,这些东西并没有让安德鲁感到不安。当然,我可以改进 C,当然,我可以使用商业分支。人们一直在谈论冒名顶替综合症,但事实恰恰相反。安德鲁对他能完成的事情非常自信和自信。

安德鲁:从一开始,我的态度就是,“让我们他妈的开始吧。我们走吧。我不是在胡闹。” 当你第一次做一个项目时,很明显,你不是独一无二的,你不是独角兽。很多人创造的编程语言并不令人印象深刻,也不有趣。所以,一开始人们都称它为玩具语言。

那很好。我只是让它滑动。我必须做的部分工作是营销并让人们对此感到兴奋。所以,我知道一开始拥有一种玩具语言的声誉是可以的,我不会为此争吵。但在我的脑海里,我在想,“哦,等一下。这不是玩具。”

亚当:太棒了。我喜欢那个。如果你要跑马拉松,我想很多人都有完成马拉松的目标,但你就像,“我会赢的。”

安德鲁:是的。

Adam:然后拿下 C。

安德鲁:我们走吧。是的。

亚当:是的。

安德鲁:我确实觉得我有一种感觉,比如什么是酷的,什么是令人畏惧的。如果您的帖子出现在 Reddit 或其他网站下。所以,我肯定非常清楚,我要怎样才能让人们觉得我不会显得太傲慢,对他的裤子来说太大了,即使我是?

亚当:是的。因为在你的脑后,你就像,“是的。我们正在拿下 C。” 但是你就像,我只是想……让我们慢慢地向人们介绍这个概念。

安德鲁:是的。确切地。

Zig的未来

亚当:当你拿下 C 时,世界会是什么样子?

安德鲁:哦,它很漂亮。它看起来几乎是一样的,除了你所有的应用程序都运行得更好,它们崩溃的频率更低,它们使用的内存更少,而且它们运行得更快。当教授教授操作系统课程时,显然会假设您只使用 Zig。那不是重点。当教科书试图说明操作系统如何工作或嵌入式设备如何工作时,这只是设置,就像假设您将使用 Zig 作为示例代码一样,因为这正是每个人所做的。

世界不会真的有那么大不同,它只是为每个人提供更好的编程体验。所以,从某种意义上说,我有很大的野心,因为我想推翻这个根深蒂固的玩家,但另一方面,Zig 实际上并不是一种超级雄心勃勃的语言。它只是试图将其提升到更快、更少内存、更少错误、更好的开发体验、更好的最终用户体验的下一个层次。只是稍微好一点。

Adam:所以,它只是对 C 的增量改进?

安德鲁:是的。所以,这就是野心的阴阳。

亚当:你没有接受图灵奖的愿景,而且……是的。

Andrew:不会。作为程序员,每个人在日常生活中的压力都会减轻一些。就是这样。

给开源开发者的建议

Adam: Andrew 花了五年时间打造 Zig,五年是一段很长的时间,而 Zig 现在不仅仅是他一个人。Zig Software Foundation 现在正在支持其他全职员工,而这一切都是通过捐款来实现的。Andrew 有一些关于自筹资金您自己的开源项目的技巧。

安德鲁:我认为对于那些试图以非常规方式谋生的人来说,没有比现在更好的时机了。我的建议是因为喜欢它而去做,不要害怕在众筹平台上露面并寻求建议,不要指望一夜成名。我还认为人们确实想要一个,他们想要相信的东西,对吗?

我想在 Zig 的早期,我的感觉是,我们要对付 C,对吧?这是一个雄心勃勃的项目,但我会坚持下去。我是来成功的。我们走吧。我们开工吧。这是一种人们可以接受的氛围。

我们开工吧。我们走吧。

拿出我的小费罐

亚当:那是表演。我发现安德鲁是一个非常鼓舞人心的人。所以,是时候拿出我自己的小费罐了。如果你去patreon.com/adamgordonbell,你可以找到播客的 patreon 页面,如果你喜欢这些剧集并希望我继续投入更多时间,请考虑设置定期捐赠。

制作每一集都需要我很多时间,这就是为什么我现在只能每月制作一集。所以,如果你想支持这个节目,那就去看看吧。我会在演出说明和网页上放一个链接。

直到下一次,让我们这样做。我们走吧,否则对不起。我的意思是非常感谢你的聆听。

你好,
我做 CoRecursive 是因为我喜欢有人和我分享一些项目背后的细节、一些错误或一些事件。

没有其他播客像我想听的那样讲故事。

现在这一切都是由我一个人完成的,我喜欢这样做,但也很累。

向其他人推荐这个节目并为这个 patreon 做出贡献是你能做的最重要的事情。

无论您能提供什么帮助,我都非常感激!

谢谢!亚当戈登贝尔

支持播客