News for hackers. Stuff that matters.
Re:PowerNex: a kernel written in the D Programming Language by pjmlp on Friday June 24, 2016 @01:07PM (#11971534)
D's GC really could use some love, but they are working on it this year's GSoC.

As for using GC in a systems programming language, even last a few days ago we had the links from Xerox Star. Originally developed in Mesa, which eventually became Cedar, that made use of GC.

Also the whole set of ETHZ Oberon workstations.

And many other experiences.

The oldest I can find is a Flex computer system developed by the UK Royal Navy in Algol-68RS.

I am pretty convinced, that just like e.g. JavaScript performance, there needs to be someone with enough money to bully the industry with such technologies until they stop being tabu.

I still remember reading from C guys on Usenet that C++ would never be usable for writing OSes.

Yet there are quite a few of them now.

Re:PowerNex: a kernel written in the D Programming Language by PeCaN on Friday June 24, 2016 @01:48PM (#11971890)
I didn't say D wasn't suitable for writing OSes. Might as well throw Singularity into the list of GCed operating systems.

I did say D is unsuitable for real-time and soft-real-time programs, OS or otherwise. You can't write an RTOS in D.

Re:PowerNex: a kernel written in the D Programming Language by WalterBright on Friday June 24, 2016 @05:09PM (#11973499)
> You can't write an RTOS in D.

Can't is a pretty strong word. You can write C-style code in D that compiles and behaves identically to C, including malloc/free.

Re:PowerNex: a kernel written in the D Programming Language by PeCaN on Saturday June 25, 2016 @01:36AM (#11975370)
I… I just got corrected by Walter Bright.

That's true. You actually can write an RTOS in D, and it would still be more pleasant than in C (thanks to D's excellent metaprogramming). The problem I have with opt-out GC in D is that it leaves you with very little else as far as memory safety goes—you have RAII, but nothing like Rust or Cyclone or other languages that are explicitly safe without a GC. You can leak, you can crash, you can have race conditions, etc, almost as easily as in C. Some sort of D version of unique_ptr would get you part of the way there, but it's still not as complete as Rust.

Re:PowerNex: a kernel written in the D Programming Language by WalterBright on Saturday June 25, 2016 @02:53AM (#11975511)
D does have @safe, which does a good job of preventing large classes of unsafe pointer issues. It is not perfect yet (we're working on it) but it is far better than "nothing like", and far better than C/C++.

For example, it does array bounds checking.

Re:PowerNex: a kernel written in the D Programming Language by PeCaN on Saturday June 25, 2016 @12:52PM (#11976947)
Interesting, I didn't know about @safe. I need to study D more!

At the moment I'm pretty happy with OCaml and learning Rust, but D definitely has me interested (especially when the no-GC stdlib completes).

Re:PowerNex: a kernel written in the D Programming Language by pjmlp on Friday June 24, 2016 @02:22PM (#11972161)
Sure, I was just kind of brainstorming how much better GCed operating systems could be.

As for RTOS, maybe you eventually could assuming future major improvements and compilers like the Atego JDK, but there is little to gain versus what Ada, SPARK and eventually Rust already offer today.

Re:PowerNex: a kernel written in the D Programming Language by Matthias247 on Friday June 24, 2016 @04:02PM (#11972980)
For hard realtime systems most kinds of dynamic memory allocations are a no-go. A lot of programs with such requirements have everything statically allocated, others use some static memory pools and custom allocators that those. I think that should also work with D - with the problem of losing lots of the standard library.

I think the most problematic area is somewhere in between: Applications that want a mostly realtime performance without having to put too much work on guaranteeing it (e.g. Games, Low Latency Audio Processing, ...).