Hacker News new | ask | show | jobs
by shmerl 2612 days ago
A pity wlroots itself isn't written in Rust.
1 comments

C is the lingra franca of programming. By writing wlroots in C, we make it easy for a half dozen projects to make bindings to other programming languages. Rust is the only one that seems to have failed, and it's not surprising given the constraints of the language.

wlroots brings together over a dozen different libraries and interfaces which are implemented in C. You'd have to repeat this process a dozen times over, running into the same problems which caused Timidger to abandon wlroots-rs, only more so. And for what? wlroots works great and didn't require shaving a thosuand yaks.

I know you know this, but for the benefit of others, you're talking about the C ABI, not about the language itself. Rust can expose a C ABI as well, and you'd get all those same bindings benefits.

> wlroots brings together over a dozen different libraries and interfaces which are implemented in C.

This is a great argument that it should be written in C, though.

> By writing wlroots in C, we make it easy for a half dozen projects to make bindings to other programming languages.

Rust is the same in this regard, you can bind it to any other language. And it doesn't have the horrible downsides of C. So why not use it?

> wlroots brings together over a dozen different libraries and interfaces which are implemented in C.

That's an issue as well, and this of course runs deep. But starting somewhere should be still possible.

>So why not use it?

Because I don't like it, and I do like C. Rust is not the second coming of Christ, it's a programming language and has many shortcomings and tradeoffs.

Which is fine, everyone has their own taste and every language has its shortcomings, but then why didn't you say that from the beginning? Instead you made up a stupid argument that with wlroots being written in Rust other projects would have had a much harder time to make bindings to other programming languages. Which is of course bullshit since Rust allows you to provide a C ABI, hence creating language bindings is as simple as with C.
>Which is of course bullshit since Rust allows you to provide a C ABI, hence creating language bindings is as simple as with C.

No, because C already uses the C ABI. You have to have a separate interface to your Rust code which uses the C ABI, and an uncomfortable transition point between C-land and Rust-land. This is definitely not as simple as it is with C.

That wasn't your argument. Your argument was that other projects have a much easier time to create language bindings for wlroots if it's written in C and know your argument changed to: I have a much easier time to provide a C ABI if wlroots is written in C instead of Rust.
In my view, tradeoffs of C are objectively much worse overall. I.e. it's not about taste, it's about the language limitations. Tastes are a different matter and they of course can differ.
C is the lingua franca of UNIX based platforms.

Thankfully not all OSes bow to it.

I think it has less to do with OS then you think. It has more to do with compilers/programming languages.

On Windows and Android if I'm interfacing to a Rust/Python/Java (on Windows)/C++ (on Android) library I still do it by going through C.

On Android you can do it via the NDK sure, but then again 90% of the OS is exposed via Java APIs, even a basic thing like opening a file requires Java, if you want to do it in a portable, certified Play Store way.

And on Windows, .NET MSIL or COM are much better ways to expose libraries.

Naturally one can still do it in an old fashion way.

>Thankfully not all OSes bow to it.

Right, just the successful ones.

That's hardly an argument for using C though. Successful OSes today were started years ago when there was barely anything else to use. It takes a long time for OS to gain success. Rust is so young, that to evaluate success of an OS written in it, you'd need to wait comparatively. So time will tell.
We could say the same related to JavaScript and Web, and it doesn't make it better.

Don't mistake success due to quality and being widepread thanks to historical accidents, free access to source code and the consequence market forces of POSIX adoption.

Not Windows.
Right, because Win32 is a shining beacon of good design. Thank god it's not C, right?
Meanwhwile Linux is still trying to catchup with the security level of mainframes.

68% of out of bound kernel expoloits in 2018, nice.