News for hackers. Stuff that matters.
Re:The State of Rust on Haiku by adamnemecek on Friday July 06, 2018 @02:18PM (#17473831)
I wonder if Haiku could become the foundation for a new os. Haiku but based on Rust. It would be a match made in heaven, Haiku's secret sauce is the asyncness of the API. This was doable in C++ however Rust and haiku are a wombo combo!
Re:The State of Rust on Haiku by dnautics on Friday July 06, 2018 @04:11PM (#17474734)
Having programmed in the BeOS API long ago, and now a BEAM language developer, I noticed that basically they were implementing a crude and unsafe actor model. There must be modern libraries that provide that at a lower level than say the erlang VM, but with better safety guarantees than C++.
Re:The State of Rust on Haiku by tormeh on Friday July 06, 2018 @05:44PM (#17475376)
Actix[0] is probably what you're looking for. I don't think the actors in Actix are network transparent, though, which is a bummer for distributed applications, but wouldn't matter for an OS.

0: https://actix.rs/

Re:The State of Rust on Haiku by losvedir on Friday July 06, 2018 @06:25PM (#17475587)
I think a lower level, type safe, actor based framework is the idea behind the Pony language, which I've been meaning to check out.
Re:The State of Rust on Haiku by dnautics on Saturday July 07, 2018 @12:05PM (#17479095)
Obsessive type safety in my opinion is a bit silly, it stems from this thought that you can squeeze out every possible runtime error by defensively coding. The truth is, you can't; there are going to be language errors, os errors, driver errors, and errant cosmic rays. Designing for resilience is not solved by typing, and an obsessive typing pattern can create a false sense of security.
Re:The State of Rust on Haiku by OtterCoder on Sunday July 08, 2018 @04:02PM (#17485878)
Bah, I've seen runtime errors with dynamic and strict typing, and I'll take type safety any day. Besides, good type systems like Rust's force you to think about all sorts of errors at all points of the program. It's harder to write, but it's harder to break, and much, much easier to fix.
Re:The State of Rust on Haiku by dnautics on Sunday July 08, 2018 @04:59PM (#17486164)
have you ever programmed in a BEAM language like erlang or elixir? It's easy to write, when there are errors, most of the time it's "no big deal". If something that is outside of your control (someone else's code, or hardware, or a driver, etc) then it's often not a fatal problem. Pushing errors to the edge is great, but "forcing you to think about all sorts of errors", I think is an antipattern. You should code the happy path, anticipate the 80% errors, patch the next 19% error, and ignore the last tiny sliver of errors, and generally be able to refactor easily.

Of course your environment should be able to survive and persist 99.99999% of errors, that's critical... there should be no throw()s or panic()s.

Re:The State of Rust on Haiku by OtterCoder on Monday July 09, 2018 @01:05AM (#17488086)
No, and I really should give those a try. That said, when I just want happy-path, idc, just reload on errors, kind of code, it's a sore temptation to just reach for JS.
Re:The State of Rust on Haiku by krylon on Saturday July 07, 2018 @09:53AM (#17478496)
I played around with Pony a little, and I found the library situation unsatisfactory.

But the type system is gorgeous. And the community is awesome.

Re:The State of Rust on Haiku by drb91 on Friday July 06, 2018 @02:29PM (#17473942)
You’re basically describing Fuschia. I believe they have some of the main haiku kernel (probably a bad description) developers.
Re:The State of Rust on Haiku by return_0e on Friday July 06, 2018 @02:58PM (#17474185)
Well Zircon (Fuchsia's kernel) doesn't have any Rust code inside of it; it's C++. Parts of rust code used in Fuchsia can be found in the Garnet layer and it is just one of the languages that can interface with the OS via the FIDL (Fuchsia Interface Definition Language) [0][1]. An example of this is a tool written in Rust that communicates with parts of the bluetooth stack[2]. The network stack is also using it and is written in Go. [3]

[0] https://github.com/fuchsia-mirror/zircon/tree/master/system/...

[1] https://github.com/fuchsia-mirror/zircon/blob/master/docs/fi...

[2] https://github.com/fuchsia-mirror/garnet/tree/master/bin/blu...

[3] https://github.com/fuchsia-mirror/garnet/tree/master/go/src/...

Re:The State of Rust on Haiku by captainmuon on Friday July 06, 2018 @04:24PM (#17474824)
From the technical side, maybe. From the user side they could not be more different. BeOS was the ultimate power user OS. You had a lot of power, but also responsibility. It included many features like the novel filesystem that more pragmatic OSes didn't include.

Fuchsia, as far as I can see, is the ultimate "modern" OS. While very safe, it will be very locked down, in the tradition of iOS, Android, Secure Boot, HTML5+js etc. but "done right". There will probably be a lot of things I won't be able to do with a Fuchsia phone.

Re:The State of Rust on Haiku by solarkraft on Friday July 06, 2018 @05:02PM (#17475079)
I'm very happy Fuchsia is open source, so forks & custom ROMs will still exist.
Re:The State of Rust on Haiku by greenhouse_gas on Friday July 06, 2018 @06:31PM (#17475626)
Are you sure? While its open source, your phone won't be (since the OS is MIT licensed, your OEM won't have to give you anything). Can you build a custom ROM without kernel sources?
Re:The State of Rust on Haiku by drb91 on Friday July 06, 2018 @08:10PM (#17476056)
This doesn’t seem to have anything to do with the software, though. You can easily lock down linux for a given phone if that’s your goal (at face value anyway).
Re:The State of Rust on Haiku by e12e on Friday July 06, 2018 @10:15PM (#17476500)
Well, this is the reason the gpl v3 came about - to ensure the four freedoms even when faced with "trusted computing".
Re:The State of Rust on Haiku by IntelMiner on Friday July 06, 2018 @11:48PM (#17476862)
Unfortunately Torvalds rejected migrating to it, and seems to be quite an outspoken critic against the GPLv3
Re:The State of Rust on Haiku by thelastidiot on Friday July 06, 2018 @07:12PM (#17475816)
I appreciate what you are saying. So many people assume that open source gives them the keys of the castle, while later they realize that a simple broadcom closed source driver puts the whole openess in the trash.
Re:The State of Rust on Haiku by lambda on Saturday July 07, 2018 @05:38AM (#17477836)
I've been happily buying Nexus and Pixel phones for as long as they've existed, on which you can easily unlock the bootloader and build your own ROM if you want. I don't see why Google would stop doing that just because they've released a new OS.

If you're concerned about installing your own software on your own hardware, why not buy it from a manufacturer that protects your freedom to be able to do so?

Re:The State of Rust on Haiku by pjmlp on Saturday July 07, 2018 @07:42AM (#17478089)
Well for starters they have been cleaning up Android from GPL related licenses.

Android now compiles with clang, including their own modified Linux kernel, and gcc is no longer supported on the NDK.

Re:The State of Rust on Haiku by lambda on Monday July 09, 2018 @03:11PM (#17492646)
Yes, but they are still shipping AOSP and still selling Pixel phones with unlockable bootloaders.

Clearly, Google wants to be able to support companies which want to sell locked-down phones.

But as long as they sell their own phones with unlockable bootloaders, you can vote with your wallet and buy those phones.

I am concerned about the reduction in use of the GPL, but what I care about is being able to run and modify the software on my phone, and as long as Google is still releasing AOSP (and the Fuchsia open source project), and selling phones that are unlocked, I'm happy enough with that.

Yes, they might change their policy in the future. But for now there's no indication that they intend to do that; they've always been good at selling their own phones and Pixelbooks with unlockable bootloaders that does allow you to replace the ROM if you want.

Re:The State of Rust on Haiku by solarkraft on Sunday July 08, 2018 @08:25PM (#17487114)
I (not having looked at the architecture yet) have a suspicion that Fuchsia will run on a hardware-independent layer, like Treble which they're pushing right now.
Re:The State of Rust on Haiku by Apocryphon on Friday July 06, 2018 @05:25PM (#17475259)
HTML5+js is very locked down?
Re:The State of Rust on Haiku by nerdponx on Friday July 06, 2018 @06:48PM (#17475710)
Maybe in the sense that webpages cannot talk to each other directly.
Re:The State of Rust on Haiku by gameswithgo on Saturday July 07, 2018 @12:29AM (#17477004)
or the hardware
Re:The State of Rust on Haiku by pjmlp on Sunday July 08, 2018 @07:27AM (#17483253)
Yes, think of ChromeOS.

You are locked to the browser sandbox and web sites, which you will never see the code running on their servers.

X11 terminals are back, just prettier.

Re:The State of Rust on Haiku by tormeh on Friday July 06, 2018 @05:47PM (#17475396)
How does Fuchsia compare to Redox?

The PL nerd in me is thinking: "Written in C++. Lame." Of course, that attitude didn't work out very well for the iPod guy.

Re:The State of Rust on Haiku by drb91 on Friday July 06, 2018 @08:09PM (#17476053)
They seem fundamentally different. Fuschia is realtime and, I think, engineered toward embedded and mobile at the moment. Redox is more about cleaning up unix (that’s my impression, anyway). If you squint, it’s like qnx vs linux/bsd, I guess.
Re:The State of Rust on Haiku by vitno on Saturday July 07, 2018 @12:38PM (#17479248)
Fuchsia is not realtime.
Re:The State of Rust on Haiku by drb91 on Saturday July 07, 2018 @05:17PM (#17480631)
You’re right, I think I was conflating concepts here. My bad. I would edit if I could.
Re:The State of Rust on Haiku by mtgx on Saturday July 07, 2018 @05:35AM (#17477822)
Does Fuchsia use Rust at all? Because if not, it should. It seems like a wasted opportunity not to preempt tens of thousands of future memory corruption bugs over the next few days for a brand new OS by not using Rust.
Re:The State of Rust on Haiku by Apocryphon on Friday July 06, 2018 @02:55PM (#17474164)
I've always wondered what BeOS would look like as a smartphone platform. Even from a UX standpoint, similar to the Windows 95 Mobile concept video.
Re:The State of Rust on Haiku by chipotle_coyote on Friday July 06, 2018 @04:30PM (#17474866)
It would have looked a lot like PalmOS 6, a/k/a PalmOS Cobalt. Palm bought Be's assets -- and many of their engineers -- when the company failed, and built their next generation PalmOS around it. For reasons as much due to internal politics as anything technical, though, they never shipped any Cobalt-based phones.
Re:The State of Rust on Haiku by adamnemecek on Friday July 06, 2018 @02:42PM (#17474065)
What language is the fuchsia api in?
Re:The State of Rust on Haiku by drb91 on Friday July 06, 2018 @08:06PM (#17476043)
IIRC there are native rust bindings for syscalls. The syscalls themselves are implemented in C++. I have no idea about the user space, but my impression is that rust is a first level language for things like the ui.

EDIT: it looks like they have interface generators for their APIs, which includes rust support as a first class citizen.

Re:The State of Rust on Haiku by Thaxll on Friday July 06, 2018 @05:22PM (#17475230)
I think at the OS level, safety from Rust are less useful. The "wrap unsafe code" doesn't really work.
Re:The State of Rust on Haiku by blintzing on Friday July 06, 2018 @05:28PM (#17475275)
There’s a nice Stanford class I took called CS 140E that had students write an OS for the Raspeberry Pi in Rust. There are actually some benefits to using Rust at this level, though it can be a bit cumbersome at times.

Check it out here: https://web.stanford.edu/class/cs140e/

Re:The State of Rust on Haiku by pieterr on Saturday July 07, 2018 @08:05AM (#17478139)
Interesting! One of the instructors is RocketMan. :-)

https://crates.io/crates/rocket

Re:The State of Rust on Haiku by steveklabnik on Friday July 06, 2018 @05:24PM (#17475248)
Have you tried it? My experience is that it works pretty well, though I've mostly been working on toys. Even bigger projects like Redox have shown that you generally don't need very much unsafe.
Re:The State of Rust on Haiku by leshow on Saturday July 07, 2018 @11:52AM (#17479022)
If you've written any amount of Rust then that's provably not true. You've no doubt used functions & methods that use unsafe (somewhere down along the line), and you didn't need to deal with it. That's 'wrapping unsafe code' used in practice. You got to write safe because someone else wrote the unsafe wrapper.
Re:The State of Rust on Haiku by TomMarius on Friday July 06, 2018 @08:57PM (#17476230)
What do you mean, doesn't really work? In my experience, it works perfectly. Could you share more info?