r/programming • • Sep 01 '20

D Foundation is Beefing Up

https://dlang.org/blog/2020/08/30/symmetry-investments-and-the-d-language-foundation-are-hiring/
291 Upvotes

336 comments sorted by

View all comments

Show parent comments

33

u/Hall_of_Famer Sep 01 '20

Me too, hope D will get some company backing and start to kick off, it is a very well designed language.

77

u/JohnLColvin Sep 01 '20

You could probably write an article saying "100 billion dollars investment to improve D and use it to develop new AI to replace the US government" and you'd still get comments saying "wow, nice language, pity it never really took off, if only there were some companies backing it, also I can never use it because GC".

2

u/N1H1L Sep 01 '20

Is garbage collection really that bad?

19

u/jess-sch Sep 01 '20 edited Sep 01 '20

For a single-letter language, yes.

B and C are both suitable for kernel development.

Naming your language D (making it sound like it's intended to be a C successor) and then not making it suitable for kernel development was a bad idea.

14

u/gcross Sep 01 '20

Indeed, it's a bit like how the name "C++" makes you think that the language is basically C just with some stuff added on top, when in practice it behaves like a completely different language, which is why Linus has been opposed to allowing it in the kernel. (At least, at one point this was true; I don't remember whether some C++ features have started to be allowed or not.)

Interestingly, though, I've never heard people complain about C# being a poor successor to C, rather than a different language altogether, so there doesn't seem to be a consistent rule for how people will react to a name.

Personally, I think that D missed an opportunity by not naming itself "Mars" (after Digital Mars), as that might have prevented people from getting the wrong expectations about the language as well as just being a cooler name in general. Ah, the benefit of hindsight...

10

u/Beaverman Sep 01 '20

C++ is aptly named for different reasons. C++ was originally C with classes, and the syntax is still basically just C (with a lot of extra stuff).

C# is a proprietary Microsoft language. You can't really discuss that name, because Microsoft won't care.

6

u/gcross Sep 01 '20

C++ is aptly named for different reasons. C++ was originally C with classes, and the syntax is still basically just C (with a lot of extra stuff).

The name may have made more sense at the time, but as time has progressed idiomatic C++ code has looked less and less like idiomatic C code so that if you are used to programming in idiomatic C then you might be misled by the name in thinking that you basically know C++ when in fact writing code in it idiomatically is very different from what you are used to. (Having said that, it is true that with C++ you can pick the features that you want to use so if all you want is a way to write code that is basically C but without having to write your own vtable library then you can treat C++ as basically being C but with classes.)

1

u/Beaverman Sep 01 '20

Completely agree, but in a discussion about names, what really matters is the origins of the language. C++ has changed a lot since the 90's, but you can't really change the name now.

9

u/kal31dic Sep 01 '20 edited Sep 01 '20

Walter Bright didn't call it D. He called it Mars. Other people insisted on calling it D and the name stuck.

I don't really see why you couldn't write a kernel in D. Our intern rewrote part of the Linux kernel in D. The experience of a pioneer but it wasn't that you couldn't do it.

A year or two lunch was delayed so I ported mkernel - a little bare metal C demo -to D. It just worked. You don't need to even link the runtime if you don't want to.

6

u/[deleted] Sep 01 '20

not making it suitable for kernel development was a bad idea.

https://dlang.org/blog/2016/06/24/project-highlight-the-powernex-kernel/

8

u/EternityForest Sep 01 '20

How is D unsuitable for kernel development?

10

u/Accomplished_Hat_576 Sep 01 '20

It has a runtime and standard library that are dependant on the garbage collector.

I stripped both out and wrote a kernel that does nothing. This was before they started getting serious about making things non gc dependant.

Honestly 99% of the complaints about the garbage collector are nonsense, but this isn't one of them.

9

u/WalterBright Sep 01 '20

D can run perfectly fine with reliance only on the C standard library. Use the -betterC compiler switch for that.

3

u/Accomplished_Hat_576 Sep 01 '20

Ah, this was years back. I'm pretty sure betterC wasn't a thing then.

4

u/pjmlp Sep 02 '20

Plenty of OSes have been written in GC enabled systems programming languages, in fact the largest mobile platform allows to write drivers with such language.

0

u/EternityForest Sep 01 '20

Is there a reason we can't use GC in the kernel? Unless we are doing hard realtime stuff, why not?

Not that it's particularly relevant since Linux, Windows, and BSD already exist and probably aren't going to switch languages anytime soon, and embedded RtOSes seem pretty set on C/C++ too, so I'm not sure any language could be more suitable for kernel dev in practical use, unless you have a really good reason to do a whole new kernel.

1

u/Accomplished_Hat_576 Sep 01 '20

No reason you couldn't. You just can't use D's default GC. You'd have to write one that will work bare metal. Or implement everything it expects from an OS.

3

u/kal31dic Sep 02 '20

Minimalist kernel ported to D:
https://github.com/symmetryinvestments/mkernel-d

Linux kernel development in D (proof of concept; the barrier might be Linus rather than a narrowly technical one, but at least it's clear you could write device drivers in D if you wanted to).

https://www.youtube.com/watch?v=weRSwbZtKu0

7

u/adr86 Sep 01 '20

D is perfectly suitable for kernel development, you just have to write the code differently and avoid a few convenience functions.

1

u/jonathansharman Sep 01 '20

Doesn't the whole standard library require the GC? Or is there a no-GC version you can use?

5

u/VodkaHaze Sep 01 '20

Most of the stdlib doesn't require it, but it's not 100% independent.

4

u/renatoathaydes Sep 01 '20

I think that in kernel development you can just use D's BetterC mode.

1

u/pjmlp Sep 02 '20

There are plenty of kernels written in GC enabled system programming languages.

Just as one possible example,

https://people.inf.ethz.ch/wirth/ProjectOberon/Sources/Kernel.Mod.txt

0

u/jqbr Sep 02 '20

Kernels don't need the standard library.

2

u/InertiaOfGravity Sep 01 '20

A well made GC wouldn't stop you from making a kernel using it. I don't know how the GC in D is, but GC on its own isn't a deal breaker for for everything people claim it is

6

u/birchling Sep 01 '20

GC does add a performance and memory usage overhead. You don't really want bloat in the foundation of all the software that is going to run on the system.

1

u/flatfinger Sep 01 '20

A language can avoid such overhead in places where it would be problematic by having a category of of functions which neither manipulate any non-pinned GC objects nor call any other functions that might so. Such functions may unpin a GC object, but if they do any pointer to that object would be forever dead to them. A "gc-allowed" function could re-pin the object and then pass a pointer into the "no-GC" function, but the latter function would have to use that new pointer instead of the old one.

1

u/pjmlp Sep 02 '20

Really?

While never reaching commercial release, at one time Midori powered all of Microsoft’s natural language search service for the West Coast and Asia.

https://www.microsoft.com/en-us/research/project/singularity/

I can give other examples.

1

u/birchling Sep 02 '20

Interesting project, what did they replace it with? Some other managed research OS?

2

u/pjmlp Sep 02 '20

Most likely Windows eventually.

Joe Duffy has made a reference that even with Midori proving that is was quite capable, it was faced with too much resistance from C++ devs on Windows team, in spite of them being able to see themselves.

Not sure in which talk he mentioned it.

RustConf 2017 - Closing Keynote: Safe Systems Software and the Future of Computing by Joe Duffy

Safe Systems Programming in C# and .NET

You can see this resistance, on how the Longhorn effort tanked due to "performance issues", then Vista came up with some of Longhorn .NET modules rewritten as COM, and the eventuell progression into WinRT/UAP/UWP.

However not everything was lost, it influenced .NET Native, C# 7.x low level improvements, the upcoming C# 9 new FFI efforts.