

It’s easier to manage/secure since it’s essentially just shell scripts
I love the fact that I can’t tell whether this is irony or not.
It’s easier to manage/secure since it’s essentially just shell scripts
I love the fact that I can’t tell whether this is irony or not.
The example even used unwrap_or_else where they should use unwrap_or. Then it uses std::i64::MIN
as fallback value where they could use something like 0
that would be a better example and honestly make more sense there.
let parsed_numbers = ["1", "not a number", "3"]
.iter()
.map(|n| n.parse().unwrap_or(0))
.collect();
// prints "[1, 0, 3]"
println!("{:?}", parsed_numbers);
Even without trimming this to something less convoluted, the same functionality (with different fallback value) could be written in more readable form.
Obviously in the context of the page something like this would make way more sense:
maybe_number.unwrap_or(0)
Or perhaps more idiomatic version of the above:
maybe_number.unwrap_or_default()
Is that Rust? Assuming a
is an Option (which would be close approximation of OP’s nullable type) and assuming b is not null, then this would be closer to the original idea:
a.unwrap_or(b)
It returns value of a
if it’s not None rather than Option.
I don’t have much experience with TS, but in other strongly typed language it goes even further than string vs number.
For example you can have two numbers Distance and TimeInSeconds and even though they are both numbers, the type system can make sure that you won’t do distance+time.
It can also let you do distance/time and return Speed type.
It will prevent many logical errors even though everything is technically a number.
Yeah it’s pretty amazing system all things considered. It’s kind of as if 8-bit home computer systems continued to evolve, but keep the same principles of being really closely tied to the HW and with very blurry line between kernel and user space. It radiates strong user ownership of the system. If you look at modern systems where you sometimes don’t even get superuser privileges (for better of worse) it’s quite a contrast.
Which is why it reminds me of Emacs so much. You can mess with most of the internals, there’s no major separation between “Emacs-space” and userspace. There are these jokes about Emacs being OS, but it really does remind me of those early days of home computing where you could tinker with low level stuff and there were no guardrails or locks stopping you.
GNU Hurd is going to be mainstream any minute now.
I couldn’t help but think of Emacs when I was reading A Constructive Look At TempleOS. It’s like TempleOS that is actually finished, it just lacks kernel.
I only remember doing this with FireWire. Which model supported target disk mode over USB-A?