News for hackers. Stuff that matters.
Re:Apple GPU drivers now in Asahi Linux by aulin on Wednesday December 07, 2022 @05:23AM (#33892733)
> I might even start contributing once Rust is more common!

as someone who's recently experimenting with Rust, why is that so? I mean if you have something in the kernel where you could give valuable contribution, why letting the language stop you? guess any dev who can write Rust today is also a good C dev, ain't it?

Re:Apple GPU drivers now in Asahi Linux by coldtea on Wednesday December 07, 2022 @06:41AM (#33893269)
>guess any dev who can write Rust today is also a good C dev, ain't it?

Quite a number of Rust devs I've read about, have never been C devs. They came from dynamic languages or Java or similar, and stuck with Rust and learned it, as a more modern features-wise and less error-prone systems language than C.

Re:Apple GPU drivers now in Asahi Linux by lynndotpy on Wednesday December 07, 2022 @09:29AM (#33894693)
I'm one such person.

I learned in C, it's the abstraction that exists in my mind for computers, but I'd never use it to actually write something, because of memory safety. I'd even been using Ada.

So, Rust was appealing in the ways C wasn't.

Re:Apple GPU drivers now in Asahi Linux by rjsw on Wednesday December 07, 2022 @06:53AM (#33893345)
I would not want someone writing kernel code who can't understand what the rest of it is doing.
Re:Apple GPU drivers now in Asahi Linux by dhruvdh on Wednesday December 07, 2022 @07:42AM (#33893663)
There is a difference between not understanding and not wanting to write C.
Re:Apple GPU drivers now in Asahi Linux by tbalsam on Wednesday December 07, 2022 @08:29AM (#33894093)
I'd be curious how C (and C++ for that matter) stacks up on some arbitrary "freshness" metric that measures some kind of statistic/statistics that indicate the average/median time it takes for the population of engineers to reach some particular level of "done"ness with a language.

I have no idea how you would measure it, but I'm assuming that C, VBScript, Perl, sed, AWK, bash, and Haskell (please don't hurt me I'm thinking about the code maintenance, time draining nightmare that is a real-world use case of mega-scaled purely functional codebases as opposed to a mixed dynamic with a purely functional core).

Curious what other languages would top the list. I'm going to assume also that some low-barrier entry scripting languages that are well designed, similar to Python, and languages that save the hypothetical, proverbial broken backs of their ancestors, like Rust, to be near the bottom of the list. I'm curious what that bottom part of the list would look like too, oddly enough. :D :))))

Re:Apple GPU drivers now in Asahi Linux by reilly3000 on Wednesday December 07, 2022 @11:27AM (#33896297)
Modern C++ now has nearly all of Rust and other modern language features built in, some as flags. At the same time it has 30 years of ecosystem, cruft, and bad habits. It’s entirely possible to write performant, memory safe C++, even in a functional style. It’s a bazooka, and won’t stop you from firing at your feet, but it is also the right tool for big jobs.
Re:Apple GPU drivers now in Asahi Linux by aulin on Wednesday December 07, 2022 @01:18PM (#33897948)
The main problem with C++ is that it's too vast, it does everything and everyone has its very own choice of a subset of the language he should use.

The result is codebases hard to navigate, code hard to undestand with lots of clever code and unintuitive syntax.

Re:Apple GPU drivers now in Asahi Linux by __jem on Wednesday December 07, 2022 @01:34PM (#33898187)
Except... you know... the most important feature of Rust... the borrow checker.
Re:Apple GPU drivers now in Asahi Linux by hedora on Wednesday December 07, 2022 @11:53AM (#33896727)
The last time I checked, there were only nascent efforts to add the borrow checker to C++.

That's the main reason to implement in Rust (the others being syntactic sugar like match, ?, and, of course, the library ecosystem that learned from ~ C++17's mistakes).

Re:Apple GPU drivers now in Asahi Linux by snotrockets on Wednesday December 07, 2022 @01:24PM (#33898038)
It still lacks memory safety.
Re:Apple GPU drivers now in Asahi Linux by halpmeh on Wednesday December 07, 2022 @10:29AM (#33895449)
C is an amazing language. If you want to integrate into another language via FFI you basically have 0 other options.

That being said, it’s too easy to do something wrong in C. The desire to use Rust isn’t because C is stale, rather it’s too hard to write C correctly.

Re:Apple GPU drivers now in Asahi Linux by tester756 on Wednesday December 07, 2022 @01:26PM (#33898077)
"amazing language"

ye ye, sure it is

uses physical pathes instead of logical namespaces for includes

average code base could be summed in such a way: everything is fucking "int" or its cousin - such a great tool for system modeling!

basic concepts as for $current_year are still non-trivial in C - like strings

when opening non-trivial codebase my VS Code goes crazy.

Maybe I do have high standards after using C# for years, but holy shit, writing Rust is 10 times better experience for me than using C.

Re:Apple GPU drivers now in Asahi Linux by Ar-Curunir on Wednesday December 07, 2022 @11:19AM (#33896165)
My desire to write Rust is for both reasons. C tooling is awful, the language offers insufficient abstraction capabilities, and, finally, is unsafe.
Re:Apple GPU drivers now in Asahi Linux by hedora on Wednesday December 07, 2022 @11:55AM (#33896761)
Rust and C++ both have C FFI boundaries that the compiler can inline across. What more do you want?
Re:Apple GPU drivers now in Asahi Linux by halpmeh on Wednesday December 07, 2022 @11:59AM (#33896830)
Well for one, I don’t want to add another language to my tool chain. Many languages can compile C directly. For instance in Swift or Go you can add C source files directly to your project and have them compile as part of your Swift or Go build. You can’t do that with Rust or C++.

C is the lingua franca of the software development world.

Re:Apple GPU drivers now in Asahi Linux by tbalsam on Friday December 09, 2022 @06:58PM (#33928151)
Er....
Re:Apple GPU drivers now in Asahi Linux by pitched on Wednesday December 07, 2022 @09:27AM (#33894656)
I would also really love to read a statistics-based approach to all of modern software engineering. Like, does SOLID actually increase bugs? Is Agile more likely to slow things down? Etc.

This is the closest I’ve ever found: http://www.knosof.co.uk/ESEUR/

Re:Apple GPU drivers now in Asahi Linux by hedora on Wednesday December 07, 2022 @12:01PM (#33896848)
It strongly depends on the type of software being developed.

As the abstract of that book suggests (when referring to ego and bluster), 100% of the agile proponents I have encountered are incompetent. (This especially includes organizations that claim they are "agile").

Re:Apple GPU drivers now in Asahi Linux by coldtea on Wednesday December 07, 2022 @07:01AM (#33893395)
Who said those people will be writing kernel code?

Rust for the Linux kernel is like 0.000001% of real life Rust use (which is not that big to begin with).

And it wouldn't be used the main kernel for the most part anyways, mostly (if not exclusively) kernel drivers.

Re:Apple GPU drivers now in Asahi Linux by rjsw on Wednesday December 07, 2022 @07:19AM (#33893482)
This thread is about a kernel DRM driver written in Rust, writing any DRM driver requires a lot of knowledge about how the rest of the DRM subsystem and the kernel works.
Re:Apple GPU drivers now in Asahi Linux by coldtea on Wednesday December 07, 2022 @08:11AM (#33893928)
The subthread though is about whether "any dev who can write Rust today is also a good C dev, ain't it?", not about kernel drivers...
Re:Apple GPU drivers now in Asahi Linux by yazaddaruvala on Wednesday December 07, 2022 @09:56PM (#33903561)
I understand C just fine, hacked on kernels before, could easily write “safe C”.

1. I just don’t enjoy C. At this point after writing so much code “for profit” it’s no longer a hobby in itself. If I’m writing code “for purpose” I need to enjoy it!

2. While I trust myself just enough to write some C, I don’t trust everyone else to retain a strong foundation for whatever I’m building on top.

3. C has carried the Linux kernel for its first 40 years. Having used Rust it’s clear the future (while maybe not Rust) is definitely not C. I want to make a contribution that will endure the next 40 years of Linux.

Re:Apple GPU drivers now in Asahi Linux by rowanG077 on Wednesday December 07, 2022 @11:00AM (#33895890)
That's a pretty naive statement. No kernel dev knows what the rest of it is doing. Because the rest is a tens of millions of lines code base.
Re:Apple GPU drivers now in Asahi Linux by sebzim4500 on Wednesday December 07, 2022 @06:21AM (#33893123)
>guess any dev who can write Rust today is also a good C dev,

I'm sure they have the potential, but they might not want to learn/use C.

I'd certainly be much more likely to look at kernel dev if I can use rust than if I have to use C.

Re:Apple GPU drivers now in Asahi Linux by aulin on Wednesday December 07, 2022 @06:31AM (#33893201)
my point was more that given rust is so young people proficient in it have probably also experience in more classic low level languages
Re:Apple GPU drivers now in Asahi Linux by thfuran on Wednesday December 07, 2022 @02:24PM (#33898961)
But that doesn't mean they want to deal with C code in their free time.
Re:Apple GPU drivers now in Asahi Linux by potatochup on Wednesday December 07, 2022 @02:23PM (#33898934)
I used to write bare-metal C for my day job. It's pretty hard to get everything right when the language has so many sharp edges. I wouldn't want to use C for a bigger project (e.g. the kernel, drivers, a gui app) but I'd quite happily use Rust because the compiler will yell at me if I do something stupid
Re:Apple GPU drivers now in Asahi Linux by Gigachad on Wednesday December 07, 2022 @06:03AM (#33892995)
Not OP but I'm waiting for Rust support to be finished before I look at kernel development. Don't have any interest in writing C.
Re:Apple GPU drivers now in Asahi Linux by ploxiln on Wednesday December 07, 2022 @11:16AM (#33896118)
Honestly this is a bit of a fantasy. If you love Rust and hate C, and haven't looked into kernel development before ... it's a whole different ball-game than user-space Rust. With a variety of real-world hardware, and the complexity of modern CPUs, and demands of a variety of complex user-space software, you just don't have the "guarantees" and conveniences you want, at this layer. The hardware does what it does and you just have to deal with it. User-space C code can be way easier to reason about. For a small taste see https://lkml.org/lkml/2022/9/19/1105
Re:Apple GPU drivers now in Asahi Linux by Ar-Curunir on Wednesday December 07, 2022 @12:53PM (#33897619)
Yes, but dealing with low-level stuff in Rust is going to be easier than doing that in C. See for example the blog post by Asahi Lina talking about how it was easier to program the M1 GPU driver in Rust than it would have been in C.
Re:Apple GPU drivers now in Asahi Linux by caskstrength on Wednesday December 07, 2022 @07:35AM (#33893615)
Even in best case scenario Rust code will be confined to individual subsystems and drivers for a very long time. And even in these subsystems you will probably still have to interact with a lot of C code from shared data-structures in other subsystems.
Re:Apple GPU drivers now in Asahi Linux by xiphias2 on Wednesday December 07, 2022 @07:42AM (#33893665)
Most of Linux kernel is drivers, so if new drivers can be written in Rust, it's a huge win in safety for the whole world.
Re:Apple GPU drivers now in Asahi Linux by xiphias2 on Wednesday December 07, 2022 @06:29AM (#33893196)
No, it's just not true. Just look at Google's recent Android statistics as a validation.
Re:Apple GPU drivers now in Asahi Linux by jokethrowaway on Friday December 09, 2022 @02:19AM (#33918581)
I'm not paid to contribute to the Linux kernel, albeit you may get some reputation benefits out of it. It's mostly a hobby: if it sounds fun, I might do it - otherwise no chance in hell.

Contributing to a C kernel sounds like a thankless job with crappy tooling and high potential for errors - and frankly just brings back horrible memories (ahhh, the segfaults).

Developing in Rust on the contrary is quite enjoyable and I'm definitely more inclined to contribute something.

Re:Apple GPU drivers now in Asahi Linux by fulafel on Wednesday December 07, 2022 @09:04AM (#33894441)
Not really. C is a simple but dangerous language where the compiler doesn't do much for you, Rust is the opposite. It's like chainsaw juggling vs bridge.
Re:Apple GPU drivers now in Asahi Linux by Klonoar on Wednesday December 07, 2022 @03:11PM (#33899581)
Life is too short to desire writing in C and/C++.