Live data from Hacker News

Writing a Unix clone in about a month

drewdevault.com

81–90 of 140 posts

Re: Writing a Unix clone in about a month

#82
post #29

Earlier quoted context omitted.

I don't think that Apple particularly cares about porting their software to Linux. Do you feel the same about Apple? That with such an attitude, they surely cannot succeed?

Apple releases a great deal of open source software, which, so far as I'm aware, all runs on Linux as well. At least Swift, clang, and LLVM, all run on Windows as well. So does their Objective C compiler, so of Apple's programming languages , that leaves AppleScript. I would not describe AppleScript as robustly successful. I believe Apple could probably get away with keeping Swift proprietary, or only supporting Appl…

You will note that Apple invests approximately zero effort in making those projects portable.

Re: Writing a Unix clone in about a month

#84

Missed opportunity to call it Drewnix.

Fun fact: Linus Torvalds originally named his fledgling OS as “Freax”, but it was an FTP site admin who came up with “Linux” and the rest is history. So perhaps the opportunity is not completely missed…

No he didn't.

"I called it Linux originally as a working name. That was just because "Linus" and the X has to be there--it's UNIX, it's like, a law--and what happened was that I initially thought that I can't call it "Linux" publicly because it's just too egotistical. That was before I had a big ego."

https://yewtu.be/watch?v=kZlOCHYu1Vk

Re: Writing a Unix clone in about a month

#85
post #49

Earlier quoted context omitted.

Apple releases a great deal of open source software, which, so far as I'm aware, all runs on Linux as well. At least Swift, clang, and LLVM, all run on Windows as well. So does their Objective C compiler, so of Apple's programming languages , that leaves AppleScript. I would not describe AppleScript as robustly successful. I believe Apple could probably get away with keeping Swift proprietary, or only supporting Appl…

> so of Apple's programming languages So the whole part of your message about "even the FSF saying that free software should run on proprietary system" works when you want to criticize Hare, but not when looking at Apple proprietary software, right? A language is just another piece of software, I don't see why you should apply different rules to a programming language than, e.g. to a serializing system like Protobuf.…

> As a baseline, I support developers using whatever license they would like, and targeting whatever operating systems, indeed, writing whatever code they would like in the process.

> That doesn't make this specific policy a good idea.

Re: Writing a Unix clone in about a month

#86
post #45
post #18

> I also finally learned how signals work from top to bottom, and boy is it ugly. I’ve always felt that this was one of the weakest points in the design of Unix and this project did nothing to disabuse me of that notion. Would love any resources that goes in more details, if any HN-er or the author himself knows of some!

If you haven't already, I would start with Advanced Programming in the Unix Environment by Stevens https://www.amazon.com/Advanced-Programming-UNIX-Environment... It is about using all Unix APIs from user space, including signals and processes. (I am not sure what to recommend if you want to implement signals in the kernel, maybe https://pdos.csail.mit.edu/6.828/2012/xv6.html ) --- It's honestly a breath of fresh air…

Not positive, but pretty sure that this, and the Unix Network book were golden for us in the 90s when we were writing MUDs. Explained so much about Socket communications (bind/listen/accept,...) Been a long time since I looked at that stuff, but those were fun times.

Re: Writing a Unix clone in about a month

#87

Impressive, super cool, and inspiring! Example of “creating something impressive in X days” requires a lot of experience and talent that is built over years .

Drew is smart and his timeline is short but I think it’s the wrong way to look at it if you just put him on a pedestal for it. Making a UNIX clone is a typical undergrad project at most universities. Extending that to something that is complete is something that requires perseverance, not special genius.

I think it is a matter of how you are exposed to programming. I started with pascal at 9, and I wrote my first (VM-)bootable OS in junior high school (around the age of 14). Not as fancy as this of course, but it booted into an environment not unlike r4rs scheme - based on SIOD. A scheme error was handled but any C errors would immediately lead to a kernel panic.

I am not a programmer today, but I can still wrap most of my head around many low level concepts. I can't, however, write anything resembling a modern web page. Nor can I understand how any larger JS application works.

Re: Writing a Unix clone in about a month

#88
post #8

Very cool. Most of these Unix clones are usually written in C. This one is written in a new programming language.

I only read part of the FAQ. I find the desire to keep the complexity low by limiting the compiler lines of code and not using LLVM interesting, but I wonder how practical it is. The FAQ admits that because of this, it generates slower code. So it shifts the complexity to the software codebase, by telling the users to “use assembly where needed”. Seems a bit like Python’s philosophy of not introducing too much optimi…

From what I heard LLVM seems to be not very great at keeping backwards compatibility and makes no guarantees that the IR (intermediate representation) stays the same. So I imagine it can be frustrating to have a moving target.

Plus it is a heavy dependency which means projects like writing a self-hosting OS in a month are much less realistic to achieve when your compiler relies on LLVM.

And not the least, the code generation is pretty slow. If your languages cares greatly about compile speed, which it should, this is a bummer.

So yeah, for many projects avoiding LLVM might be a good idea.

Re: Writing a Unix clone in about a month

#89
post #16
post #7

I was interested in Hare until I found this immensely self-defeating FAQ item: https://harelang.org/documentation/faq.html#will-hare-suppor... As a baseline, I support developers using whatever license they would like, and targeting whatever operating systems, indeed, writing whatever code they would like in the process. That doesn't make this specific policy a good idea. Even FSF, generally considered the most extre…

On the one hand, I can respect the authors for sticking to what they want to accomplish and not accommodating every demand. On the other hand, that is hardly the only thing from the FAQ that raises one's eyebrows: > we have no package manager and encourage less code reuse as a shared value > qbe generates slower code compared to LLVM, with the performance ranging from 25% to 75% the runtime performance of comparable…

Some of those design decisions I’m okay with, but deliberately not providing a basic hash table for general usage is pretty bizarre. I can’t think of even one serious software project I’ve worked on that didn’t need a dictionary/map-like data structure somewhere in the code.

Re: Writing a Unix clone in about a month

#90
post #7

I was interested in Hare until I found this immensely self-defeating FAQ item: https://harelang.org/documentation/faq.html#will-hare-suppor... As a baseline, I support developers using whatever license they would like, and targeting whatever operating systems, indeed, writing whatever code they would like in the process. That doesn't make this specific policy a good idea. Even FSF, generally considered the most extre…

I think focusing on Linux makes sense for limiting the scope of the project. Supporting Mac sucks when you own no Apple hardware and have no personal interest in the ecosystem. Windows users probably can just use WSL, right? Or I mean, people use docker these days anyway.

So I get it. Especially if it is to be a more niche or pet project but then again I don't buy the ideological reason. I am a really big proponent of free software and their stance just doesn't make any sense. I agree with you here. But then again they can do whatever they want.

Post reply on HN