News for hackers. Stuff that matters.
Re:Safer Linux Kernel Modules Using the D Programming Language by 8jy89hui on Thursday January 05, 2023 @03:01PM (#34265677)
It has taken huge amounts of work to get the Rust ecosystem to where it is. Even still, it has huge regions where it is immature. Is anyone in the D community able to talk about how mature the ecosystem is?

I had always assumed (perhaps naively) that not many people used D and that it was a bit esoteric…? Not to offend anyone. Kind of like F.

Should developers be investing time into learning D?

Re:Safer Linux Kernel Modules Using the D Programming Language by ttkciar on Thursday January 05, 2023 @03:35PM (#34266162)
D has been around for 21 years. It has had a compiler in the gcc project (gdc) for four years. It debugs easily enough under gdb. Several editors support D syntax (including geany and vscode). It has quite a few libraries (though its interoperability with C libraries has muted native D library development somewhat), centralized at https://code.dlang.org/

Are there specific parts of the ecosystem you worry about not being mature?

As for it being a bit esoteric, yes, it's not a very widely known language, though I'm not sure why. I fell in love with it in 2018, and it has thoroughly spoiled me for writing C.

Re:Safer Linux Kernel Modules Using the D Programming Language by Conscat on Thursday January 05, 2023 @05:50PM (#34268088)
One big issue with D compared to Rust for performance-oriented code is the lack of move semantics. Rust and C++ idiomatically almost never rely on copy-on-write, whereas D so far has a lot of it. I'm not sure how much this matters for kernel modules, but I imagine that it is something users would consider. I had seen some proposals for move semantics in D, so for all I know this is under works right now.
Re:Safer Linux Kernel Modules Using the D Programming Language by destructionator on Thursday January 05, 2023 @05:56PM (#34268159)
D rarely has copy on write.

It will just plain copy certain types on assignment though so perhaps that's what you meant.

Re:Safer Linux Kernel Modules Using the D Programming Language by p0nce on Saturday January 07, 2023 @04:03AM (#34286420)
C++ code has a lot of copies actually.
Re:Safer Linux Kernel Modules Using the D Programming Language by vlovich123 on Friday January 06, 2023 @12:17AM (#34271264)
Maturity in a systems programming sense is different. Rust had a lot of effort pored (and still going) into the nostd variant to be used in bare metal applications like microcontrollers and kernels. Does D have that same level of formalism?

On a more serious note, I’m skeptical D would take. It seems like Rust has captured mind share and already has ongoing substantial work integrating it into the kernel (+ it’s the first and only non C language in kernel mainline). Given that context, I don’t see the motivation that works spur a similar level of support from kernel maintainers.

Re:Safer Linux Kernel Modules Using the D Programming Language by spookie on Friday January 06, 2023 @04:25AM (#34272705)
I'm sorry, but shouldn't we critique Dlang itself instead of the constant comparisons with Rust?

Dlang has had significant work poured into it, and the project has delivered a quality language with safety in mind. I don't mean to be defensive, but these threads always seem to ask the same question, it's boring at this point.

Re:Safer Linux Kernel Modules Using the D Programming Language by vlovich123 on Friday January 06, 2023 @03:48PM (#34280833)
I think it's fair game to discuss Rust in this context since there's a major effort underway to support writing in-kernel drivers in Rust. Unless you think the kernel will be a bazaar of languages, then it's useful to think about which language is the most likely to "win".
Re:Safer Linux Kernel Modules Using the D Programming Language by pjmlp on Saturday January 07, 2023 @06:04AM (#34287030)
There are other OSes out there where D could eventually make a mark.

Naturally the whole issue is that there is no big movement regarding writing OSes in D for that to matter anyway.

Better luck using TinyGo, Java, .NET or Oberon in bare metal workloads (where runtime plays the OS role), as there are a couple of products for them, than D.

Re:Safer Linux Kernel Modules Using the D Programming Language by spookie on Saturday January 07, 2023 @10:02AM (#34288575)
I think it would be of value, to a degree, if the kernel supported multiple languages. As some languages are better suited for some tasks.

This implies comparing them, so I understand your point now.

Re:Safer Linux Kernel Modules Using the D Programming Language by ttkciar on Friday January 06, 2023 @02:03PM (#34279273)
> Rust had a lot of effort pored (and still going) into the nostd variant to be used in bare metal applications like microcontrollers and kernels.

D has had "dcompute" since 2017, for native execution on GPUs and other accelerators. People have been writing D for microcontrollers since at least 2011, possibly earlier. D is fairly mature in the systems space.

> I’m skeptical D would take.

Maybe, maybe not. Some languages "click" better than others for individual programmers. It's good to have options.

> it’s the first and only non C language in kernel mainline

Do you foresee it being the only non-C language used in the kernel forever?

Re:Safer Linux Kernel Modules Using the D Programming Language by vlovich123 on Friday January 06, 2023 @03:46PM (#34280813)
> Do you foresee it being the only non-C language used in the kernel forever?

It's possible that maybe the maintainers are just trying out Rust to see if it can be wrangled into the kernel to start the migration process. So now may be the right time to explore other languages.

Once a next language is "chosen" then yes, I do think that there will be only 1 language for the kernel itself (modulo the very long transition time to convert all components so you'll have C + 1 other language). I wouldn't be surprised if at some point the kernel decided they're not going to accept any more C drivers because driver code is a lot more variable in quality and lower in oversight and testing. Core kernel code will take a longer time as even now that's out-of-scope for most such efforts.

Do you see it differently?