"About the only somewhat difficult challenge was that I was unable to find any clean way to switch between different virtual terminals. I ended up having to just update a pointer so that the interrupt subsystem could know which TTY to send input to." (discouraged in rust).
It's a good exercise to try to take a language with promise and use it for a systems task to understand what's possible. But sometimes some languages need to be systems languages, and others need to be application languages, because there are different assumptions and default cases we want to make easy/possible for developers.
We are talking about a system that can trace a lineage back to the Morse telegraph...
This isn't a problem specific to TTYs, but indeed they are their own special little hell no matter how you choose to tackle them.
Why would that be discouraged, and what would be the "Rust way"? That sounds like the simplest, most straightforward way to do it.
I'm not sure there is one TBH.
It makes sense. Some of the best Unix implementation work I've seen (e.g. the DG/UX reimplementation of SVR4 UNIX for multiprocessors, large storage farms, and manageability) came from the "let's consider refactoring everything" that comes with a clean-sheet design.
This really caught me. I have not played around with rust that much but having the executable be over 4MB, with such a small program such as just a Hello World is kind of nuts. I know that they still have lot of compiler optimization, but I just thought that was a very interesting portion of the read.
Also turning on optimizations in rust and the linker helped a lot but were not enough in the end.
I wonder if you have any opinions on how useful higher-kinded types (HKTs), one of the most requested features for Rust, would have been in implementing this OS. For example the absence of HKTs means that Rust can't have smooth and general handling of monads that is comparable to Haskell's. Would Haskell-style monads or Arrows have been helpful?
I believe HKT would have been useful but am not really sure how much HKT would have helped me overall. They would likely have been most useful (if at all) in the VFS/S5FS/VM stages that I was unable to fully get to.
Honestly, I have not used haskell enough to definitively say whether monads/arrows would have been useful.
> having the executable be over 4MB, with such a small
> program such as just a Hello World is kind of nuts
Also, end users might not care that much about binary size, but distribution maintainers do -- they want to fit as much functionality they can within a reasonable-sized iso download. If including a rust program in the base OS means omitting a dozen C programs that would have fit in the same space, that's a hard sell.
I am optimistic that these kinds of issues will be worked out as the language stabilizes and the tools improve.