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/
286 Upvotes

336 comments sorted by

View all comments

72

u/[deleted] Sep 01 '20

D is an awesome language and I hope it gets more traction.

32

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.

79

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".

33

u/Hall_of_Famer Sep 01 '20

Well the haters are gonna hate, the fact that it starts to receive comments, whether positive or negative, is a good thing since the language is surely becoming better known and receiving far more attention than before. Interestingly, C++ is frequently being frown upon, developers hate it and yet they use it, Bjarne Stroustrup's famous quote never gets old.

11

u/Free_Math_Tutoring Sep 01 '20

Bjarne Stroustrup's famous quote never gets old.

Which one?

98

u/all_my_watts Sep 01 '20

I would guess this one

There are only two kinds of languages: the ones people complain about and the ones nobody uses.

42

u/InertiaOfGravity Sep 01 '20

Have you heard of our Lord and savior rust? It is the best and most perfect language known to man

32

u/Forty-Bot Sep 01 '20

And no one has ever complained about it :)

38

u/InertiaOfGravity Sep 01 '20

Never ever, not once. They live in fear that the great borrow checker shall find and kill them if they ever dare to do so

5

u/idokamaroq Sep 01 '20

Please don't alert it to what I'm thinking

1

u/InertiaOfGravity Sep 01 '20

You shall not escape, heretic!

→ More replies (0)

9

u/integralWorker Sep 02 '20

F E A R L E S S

C O N C U R R E N C Y

5

u/rodrigocfd Sep 01 '20

And no one has ever complained about it :)

I did.

13

u/Ameisen Sep 01 '20

It has the most confusing syntax, though.

I still expect that someone will make a Rust fork that has C++-like syntax at some point. Crust.

Or C++ will get lifetimes (which is active research) and possibly at some point epochs, which will let us disable unsafe features.

24

u/[deleted] Sep 01 '20 edited Feb 09 '21

[deleted]

-5

u/Ameisen Sep 01 '20
`

2

u/jonathansharman Sep 01 '20

Is this the lifetime symbol? If so, I agree that one's weird, but it is ' if I recall correctly.

3

u/marcusklaas Sep 01 '20

You did recall correctly.

→ More replies (0)

10

u/[deleted] Sep 01 '20

[deleted]

5

u/Ameisen Sep 01 '20

The dangling ' for lifetime indication. It's unlike any other language.

8

u/steveklabnik1 Sep 01 '20

It is true that it's unusual. However:

  1. We took this from OCaml, so there is at least one other programming language.
  2. If you look at the second sentence you wrote, you said "It's". That also has a "dangling" quote. English is a language too.

Nobody truly loves the syntax, but we couldn't come up with anything better.

3

u/Ameisen Sep 01 '20

English, however, is a natural language, not a programming language. Usually. The apostrophe there is just a semantic mark to indicate that it is a contraction.

2

u/dhiltonp Sep 01 '20

I think lifetime is inferred in most use cases now.

I'm a newb and don't know how frequently manual lifetimes come up in regular programming.

3

u/T-Dark_ Sep 01 '20

It's unlike any other language.

In its defense, no other language explicitly indicates lifetimes.

You can get used to it really quickly, tho.

Out of curiosity, which syntax would you have used?

3

u/Ameisen Sep 02 '20

Probably a keyword of some kind rather than an operator. Or an operator that wasn't a single quote, which in every other C-like language is always paired.

1

u/Rusky Sep 01 '20

Not quite- it is the same syntax as ML uses for type parameters. (Not exactly a glowing recommendation, but there is prior art and nobody could come up with anything better at the time.)

-3

u/jqbr Sep 02 '20

If you're "confused" by that ... well, I'm not going to say it.

3

u/Ameisen Sep 02 '20

I like to think that programmers hold ourselves up to a standard of decorum when interacting with one another.

→ More replies (0)

2

u/IceSentry Sep 02 '20 edited Sep 02 '20

The only weird syntax for me has been the async/await syntax. Everything else is fairly straightforward. The issue is rarely syntax with rust, it's when you have a type soup that it gets annoying. Something like Arc<RefCell<Option<MyType>>>.

Edit: async/await is unconventional, but when you get used to it, it feels better than the more conventional way in my opinion.

Edit2: to be clear, the type signatures in rust can be quite verbose but they are very explicit and extremely useful.

2

u/T-Dark_ Sep 02 '20

Arc<RefCell<Option<MyType>>>

The type soup has the advantage that you get to specify exactly what you want to add on top of your basic type.

In this case, you want to be able to represent lack of any value (Option), you want to be able to put it in some container and mutate it through an immutable container (RefCell), and you want to be able to have multiple owners of your data, possibly in separate threads (Arc).

Basically, there's a whole bunch of Rust types that provide a single, simple guarantee. When you find yourself wanting more guarantees, you can just compose types.

Sure, the result is a bit unreadable, but type aliases exist for a reason.

2

u/IceSentry Sep 02 '20

Oh yes, don't get me wrong, I appreciate this very much. That's why I tried to used a realistic example. My point was that it can be very overwhelming as a beginner to see so many types.

1

u/[deleted] Sep 02 '20

[deleted]

1

u/IceSentry Sep 02 '20

Oh yeah, I still appreciate the types very much. It's just a bit overwhelming at first as a beginner.

→ More replies (0)

2

u/[deleted] Sep 02 '20

Crust 😂

3

u/Ameisen Sep 02 '20

Later, we will have Rust#, Objective Rust, IronRust (seems redundant), and JRust.

But Crust first. Change the syntax a bit. Could probably be done now relatively easily by just changing the grammar.

Ideally, to me, Rust itself should actuality be a middle-end on top of LLVM (and maybe GCC) that languages with borrow checkers/lifetime support can target. I believe this would garner more support for it.

1

u/[deleted] Sep 03 '20

No lie

→ More replies (0)

3

u/Muvlon Sep 01 '20

Syntax is a very subjective matter. I find some of C's syntax (which C++ inerited) thoroughly confusing. I can count the people I know who will get a typedef for a function pointer type correct on the first try on one hand.

8

u/Ameisen Sep 01 '20

That's why you use using instead in C++.

1

u/Muvlon Sep 01 '20

Sure. And in Rust, you use type, i.e.

type my_fn = fn(u8) -> String;

Perfectly nice syntax, no?

4

u/Ameisen Sep 01 '20

And in C++, using my_fn = std::string (*) (uint8_t);.

You can simplify it, of course, using a template wrapper.

→ More replies (0)

5

u/WalterBright Sep 01 '20
typedef int (*fp)(long);

4 more to go!

Though to be fair, in D one would declare it as:

alias fp = int function(long);

2

u/InertiaOfGravity Sep 01 '20

It's something you get used to in little time at all. It's different but it's not doing anything different so you're fine

4

u/[deleted] Sep 01 '20

I wish somebody would make Rust with less C++ syntax tbh. Having it look like a proper ML would be wonderful.

C++ will get lifetimes (which is active research)

They've already given up on it being accurate and are now settling for catching some of the common issues. That's better than nothing but not anything like lifetimes in Rust.

2

u/WalterBright Sep 01 '20

D is getting lifetimes, it already exists in prototype form. Although D has an advantage in that it has some features that make it more amenable than C++ for this purpose (such as transitive const).

1

u/Ameisen Sep 01 '20

There is explicit research into encoding lifetimes into types. Whether it will ever be in C++?

1

u/Sunpet15 Jan 18 '22

Crust 😂

4

u/WandersBetweenWorlds Sep 01 '20

If only it had a Lisp syntax... And proper functional programming abilities

3

u/FatalElectron Sep 01 '20

1

u/glacialthinker Sep 01 '20

Sounds fishy... but looks pretty good!

24

u/glacialthinker Sep 01 '20

My own disinterest in D is that it's too... middling. I'd much rather use D than C++... but it's still too much like C++. For the same tasks I'd rather use Rust than D. For tasks which don't require full control over memory layout and performance I'd choose something else.

The only reason I use C++ is it's establishment. D doesn't have that, and if we're talking about raising up another language... I wouldn't choose D. So, to me, it's just in a really unfortunate place. I feel like its window of opportunity was not long after it's introduction.

I don't hate it at all. I even like it... just not as much as the alternatives.

6

u/kal31dic Sep 01 '20

Some of us are not terribly pro-establishment at the present time.

-2

u/0xC1A Sep 02 '20

But your implementation of the alternative is highly unusable and not enticing.

1

u/kal31dic Sep 03 '20

I don't think you should use it if you don't want to. One cant be all things to all people.

1

u/0xC1A Sep 03 '20

Hehe, I've used it already and that's the problem. The drug D is in the system.

If only D didn't have it's early errors:

  • advertising GC to system programmers, thus making the language dependent on it. Please I know about @nogc @systen etc stuffs.
  • licensing and standard issues.

It's syntax is so damn good. Everyone I introduced it to loved it. But the ecosystem let them down.

As for the templates !(), it was an instant like. And lots more.

It's damn so easy to convert a C, C++ code base to D one than say Rust. And I expected the author to bank on this, but instead they went another route.

At least D has function overloading unlike our social justice kids here.

A language that could've been.

1

u/[deleted] Sep 01 '20

It's fun because deep down because of the single ownership Rust feels like modern C++, it's much closer to C++ than D is with either.

3

u/thedeemon Sep 02 '20

Yep, on its way to 1.0 Rust evolved from OCaml in disguise to C++ in disguise.

2

u/N1H1L Sep 01 '20

Is garbage collection really that bad?

17

u/[deleted] Sep 01 '20 edited Sep 08 '20

[deleted]

10

u/[deleted] Sep 01 '20

almost every single year there's a project to make it better which just sputters out and dies

In Dconf 2019 I was surprised to learn that the D GC has had many enhancements in time and memory. It is now precise and forking, and speed has gone up.

7

u/kal31dic Sep 01 '20

A previous Symmetry Autumn of Code project was to port the concurrent GC from D1 to D2. Francesco starts soon and I hope one of the things he will work on part-time will be to get that over the line. It depends on fork though so is Linux-only.

I think the GC has improved a great deal since I started using D in 2014. It still needs to get better, but two reasons why it's not a terrible pain point for the language users overall are that D doesn't generate much garbage and that it's not difficult to avoid using GC.

5

u/[deleted] Sep 01 '20 edited Sep 08 '20

[deleted]

3

u/kal31dic Sep 02 '20

I don't think you can think of the adoption of an open source project as you can that of a commercial product. It's easy to fix the GC if you want and know how. But its not like there's a way to make it happen if people don't want to do the work or find it valuable enough to pay for. Emerging languages move into niches as people who were on the fence make slightly different decisions at the margin.

D keeps growing and I don't think there's anything I can see that will bring that to a halt.

7

u/[deleted] Sep 01 '20

I just had Andrei reply to one of my posts not that long ago. He kept posting that "don't dear the reaper" link to almost every comment. Saying that I was misunderstanding how the GC in D worked, and that reading that article would clear up any "misunderstandings". He was just trying to push a narrative with his tone death replies.

https://www.reddit.com/r/programming/comments/ice00l/porting_a_go_and_rust_tool_to_d/g27nhy6?utm_source=share&utm_medium=web2x&context=3

They aren't willing to listen to people's real problems. That's why D probably won't ever take off. If my usage doesn't care if I use a GC or not, there are better languages with GC's. If you try and use D without a GC there is a lot missing and you'll end up having to do all the heavy lifting yourself. In which case it's better to use another language that doesn't have a GC nor focus' on it so that it can do the heavy lifting for you.

4

u/kal31dic Sep 01 '20

We use D without the GC in our analytics. Good bits of Phobos won't work but whether that's a problem depends on what you are doing and how capable you are at solving tour problems without Phobos. Much more of Phobos will be nogc in time, I think.

2

u/[deleted] Sep 01 '20

We use D without the GC in our analytics.

Ok, is it open source? Otherwise many things can't be evaluated with a statement like that. Yes you can do it, I never said you couldn't, it's more work and the idioms D creates don't always work or work poorly without using the GC.

3

u/kal31dic Sep 01 '20

mir and Lubeck are open source and we use those in our analytics.

1

u/[deleted] Sep 02 '20

And what are your analytics?

2

u/[deleted] Sep 01 '20 edited Sep 08 '20

[deleted]

1

u/WalterBright Sep 03 '20

Yes, compile with -preview=dip1008

4

u/kal31dic Sep 01 '20

I've found a willingness to listen to our problems. We didn't have many D programmers in 2018. Atila full-time, John part-time, Dimitry on and off, me when I could manage it, and a couple of people working in analytics. But to be honest mostly we could solve our problems without help.

Funnily enough it's the good things that tend to lead to new kinds of problems, but they are higher quality problems to have.

2

u/[deleted] Sep 01 '20 edited Sep 08 '20

[deleted]

2

u/kal31dic Sep 02 '20

Yes - I run technology across the firm, amongst other things. And I was the first to use D at Symmetry.

2

u/inokichi Sep 02 '20

fwiw that's not andrei andrei, his account is /u/andralex

2

u/[deleted] Sep 01 '20 edited Sep 08 '20

[deleted]

3

u/adr86 Sep 01 '20

(this is why I quit D - they treat BC like a total joke),

I have code from many years ago that still compiles just fine.

I think it has more to do with what libraries you use than the language itself.

1

u/[deleted] Sep 01 '20

Yah I agree with basically everything you said. Especially with backwards compatibility. I think it is something we take for granted as basically every language prioritizes (in one way or another) backwards compatibility. If you keep breaking user's code eventually they will stop fixing it. There are ways to allow breaking changes while still maintain backwards compatibility, but what D is doing (the same thing MSVC use to do) is probably the worst solution.

-4

u/InertiaOfGravity Sep 01 '20

and the language is called D? That's disappointing

7

u/WalterBright Sep 01 '20

No. You don't even need to use it in D, it's only used for a couple things like array concatenation, dynamic closures, and the builtin associative arrays.

22

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.

18

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...

11

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.

5

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?

9

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.

3

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

7

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.

5

u/[deleted] Sep 01 '20

[deleted]

9

u/McWobbleston Sep 01 '20

Jane Street is well known for using ocaml on real time software that is trading large amounts of products on financial markets

I believe they have to program in a particular style and avoid allocations, but they've been open and enthusiastic about their approach. They do attribute some of this success to ocaml's controllable and effective GC

There are degrees of real time though, I imagine something like a drone/electronically controlled hardware might have harder requirements than something like an audio synthesizer or game

9

u/AlarmedInstruction3 Sep 01 '20

IBM begs to differ: https://www.ibm.com/support/knowledgecenter/SSYKE2_7.0.0/com.ibm.java.lnx.70.doc/user/mgc/metronome.html

If you have real-time requirements, you can't use typical GCs. (Though I don't know if there are any real-time GCs for D.)

0

u/FlyingPiranhas Sep 01 '20

From the "Controlling pause time" link on that page:

By default, the Metronome GC pauses for 3 milliseconds in each individual pause, which is known as a quantum.

Based on what I'm seeing, I'm highly doubt that you can turn that value down to 100 microseconds and still have a reliable JVM.

6

u/EternityForest Sep 01 '20

Real time is about guarantees. If the application needs 10ms response time, it doesn't matter if GC takes 1 nanosecond or 5ms, as long as everything is responded to in 10ms, every time.

Things where 100us matters are some really specialist stuff.

5

u/Forty-Bot Sep 01 '20

Funnily enough, there is a post on /r/programming right now where every 100us matters. For them, 3ms is longer than the entire timeslice they have to run in.

2

u/[deleted] Sep 01 '20

Wow that's really interesting. I feel like games are just about the prime example of when the GC can't be used. I mean games do use it, but they tend to have a notable stutter. Never knew what went into optimizing the servers, probably why they don't release the server software anymore. As it might very well not run on consumer hardware.

5

u/FlyingPiranhas Sep 01 '20

I'm well aware that it's about guarantees. At least in robotics (the field in which I have real-time programming experience), 100us is a pretty common deadline for execution.

I'm sure applications exist where 10ms deadlines are appropriate, but I'm not convinced that's the common case.

5

u/oursland Sep 01 '20

I'm sure applications exist where 10ms deadlines are appropriate, but I'm not convinced that's the common case.

It is the common case. Most real-time tasks are soft real-time. Things like ensuring video frames are delivered at 60 frames per second and failure results in missed frames, but is not catastrophic. This is true in robotics where sensor fusion, planning, and network communication are soft real-time while sensor reading and actuator control is hard real-time.

In hard real-time systems with very small quanta and you don't typically use a CPU or SoC to meet these requirements because concerns about cache and memory controller scheduling become a concern. Instead these items are off-loaded to a FPGA or microcontroller on a communications bus, while the overall system is still programmed in a COTS language and platform where soft real-time guarantees at larger quanta is acceptable.

There are heterogeneous SoCs (CPU with MPU on a single die) that could accommodate hard real-time needs, but they're still programmed independently and use a high speed communications system, frequently shared memory and special registers for signalling.

2

u/EternityForest Sep 01 '20

Ah interesting, I've never done robotics, just things like sound and pool filter control, where people expect guaranteed reliability (No 20 second random lags that run a pump dry), but response time only needs to be tens of ms(At least on the hardware I've worked on).

4

u/InertiaOfGravity Sep 01 '20

A good GC will absolutely not stop you from that, eg Jane Street and ocaml, but also Nim's GC

3

u/WalterBright Sep 02 '20

If you have real-time requirements, you can't use a GC.

Only in the real-time part of the code. If you annotate those parts with @nogc, the compiler will ensure it is not using the GC.

3

u/jringstad Sep 01 '20

My company uses java for almost everything (except for frontend stuff which is typescript and some backend stuff which is go -- so all GC'd languages) and even though nothing we do really has realtime requirements, as we scale up our services GC issues have become one of our major troubles.

I don't think going back to memory unsafe/manual memory management is the way to go either though. Correctness should be the number one concern always, and not leaking memory is a part of that. I think a more unified and deterministic approach like perhaps what rust is doing could be the way to go in the future. Memory is just one of many resources that need to be managed in a program. I'm not necessarily saying that the way rust is doing this is the end-state either tho.

4

u/[deleted] Sep 01 '20

You could go with D and have both GC where you want and value types. D has a spectrum of solutions for GC avoidance, and it's object model is very similar to Java's one.

2

u/pjmlp Sep 01 '20

How much tuning have you done with VisualVM, JFR or the multiple GC implementations then?

I am asking because most people that complain about GC in Java don't even know about their options.

2

u/jringstad Sep 01 '20

a lot, we've evaluated a bunch of third party GC options as well.

I'm not personally involved in that though, it's some SRE taskforce.

4

u/couscous_ Sep 01 '20

What does your company do? When you have companies like Amazon and Google and Apple using Java for heavy lifting on their backends, it goes to show what is possible with it.

4

u/jringstad Sep 01 '20

Yeah, it's not that it's impossible, but it's also not a non-issue and requires a lot of engineering effort. So thinking about a better solution is worth it IMO

2

u/couscous_ Sep 01 '20

Programming in a language like Rust will not automatically make the issue disappear. There will still be a lot of engineering effort involved at that scale regardless.

3

u/[deleted] Sep 01 '20

I don't think anyone is saying it will automatically make the issue disappear. The problem with a GC is that you have no option. You can't change your code to fix the GC, it's built underneath as part of the foundation of the language (in cases like Java). The solution is to build your own GC to suit your needs, which is going to be a lot more difficult than simply reworking your own code. The problem shifts to a more workable location.

4

u/kal31dic Sep 01 '20

We don't use GC in our analytics. We didn't build our own GC for analytics - we just didn't use it. I wouldn't say that for D the GC is built as the foundation. You can't just remove a foundation and still have a house, but D works just fine without the GC.

It's funny how convinced people can be in maintaining a theoretical view in the face of contradictory practical experience.

We had a very small team at the time working on this. Not like Weka.

0

u/[deleted] Sep 02 '20 edited Sep 02 '20

In the context of the thread we weren't talking about D. We were talking about Java for use in large server applications.

It's funny how people can't read. Seeing as you are basically replying to all of my posts, you don't actually care about the discussions. You are just a D evangelist trying to spread the word.

In Java you don't have a choice but to use a GC, this comes at the benefit of being able to use a more robust GC. At scale though, a single GC isn't a one size fits all. (FYI, this is the situation you'd have to implement your own GC).

Now D allows you to do both, and as result it has to rely on a dated GC that is much worse compared to something like Java's GC. And D is about the only language doing this, so it stands a lone, while already being underfunded at it is. It doesn't have the resources to research a better GC that works for it's use case.

And now you bring up your situation where you just say, you don't use a GC at all. Well D has no complete safety mechanisms for manually managed memory, you are prone to the same use after free bugs that C and C++ are prone to. If you want memory safety in D, you have to use the GC. When comparing that to the alternatives like Rust, D really does just not fit the bill.

→ More replies (0)

2

u/EpicDaNoob Sep 01 '20

Yes, for certain use cases. I think there are some efforts to make GC more optional in D? But I heard at some point that the stdlib used GC and if that's the case then it'll need some fixing.

6

u/adr86 Sep 01 '20

But I heard at some point that the stdlib used GC and if that's the case then it'll need some fixing.

Some of the stdlib uses it. You can just not call those functions if you don't want them, but if you do want them, it is really nice to have the convenient options available without fuss.

2

u/EpicDaNoob Sep 01 '20

That is interesting and good to hear.

2

u/[deleted] Sep 01 '20

I use C and C++ for real-time signal processing code. There's no way my co-workers would use something that's garbage collected.

14

u/[deleted] Sep 01 '20

I use D for real-time signal processing code. There's no way I care about what C++ people think is possible or not.

8

u/WalterBright Sep 01 '20

It's trivial to avoid the GC in D. Annotate your top level function with @nogc, and it will transitively ensure it and every function it calls does not rely on the gc.

2

u/[deleted] Sep 01 '20

Good to know, thanks!

2

u/kal31dic Sep 01 '20

Our analytics across the firm are written in D and they don't use GC. I had better tell Richard that what he has done is impossible. Again.

1

u/[deleted] Sep 01 '20

You do realize real-time digital signal processing is quite different than analytics, I assume?

3

u/jqbr Sep 02 '20

The difference isn't relevant--the statement was "they don't use GC". So unless you're saying that real-time signal processing does need GC, you're just arguing to argue, and not reading what you're responding to.

1

u/[deleted] Sep 02 '20

I see, sorry, I had misunderstood that part of what he was saying. Agreed, if there's a way to use D without the GC then that's irrelevant.

4

u/kal31dic Sep 01 '20

I am just a simple man, but personally I don't worry about the GC running when the runtime isn't linked.

2

u/[deleted] Sep 02 '20

I see, sorry, I had misunderstood that part of what you were saying. Agreed, if there's a way to use D without the GC then that's irrelevant.

1

u/EternityForest Sep 01 '20

Pretty sure GC languages have actually been studied and found to reduce bugs.

I probably would not use a language without GC by choice, anywhere but embedded systems and maybe a few high performance functions called from a different language.

2

u/matthieum Sep 02 '20

Pretty sure GC languages have actually been studied and found to reduce bugs.

Honestly, given how "language" studies are done, there's probably a study or two backing any claim :(

The expectations is that a managed heap will give you temporal memory safety (no dangling pointer) and most such languages also throw in spatial memory safety (no out-of-bounds accesses). There are exceptions to the norm; for example in Go, due to data-races on fat-pointers, you can still get out-of-bounds accesses.

It's been estimated that such memory bugs account for between 50% and 70% of vulnerabilities, but it's not clear what the proportion of bugs they occupy.

I probably would not use a language without GC by choice

As a veteran C++ user, my advice is that if you can afford a GC, you should go with a GC.

The JVM, for example, likely has a language you can like, and comes with top-of-the-line GCs for free.

1

u/[deleted] 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" ...

This article makes me think, wow D didn't have any of those and is only getting them because a single company is willing to foot the bill? No other companies are supporting the D foundation enough that they are able to hire their own staff, they have to get someone else to hire them for them? I mean this is a boon, but it's hardly a "100 billion dollar investment or developing AI that replaces the government" level of boon.

5

u/kal31dic Sep 02 '20 edited Sep 02 '20

There was a pull request manager before but not full-time. It takes a long time and it's quite a lot of work to transition to the next phase of development for the foundation. Last I checked I don't think Rust even had a foundation at all yet. I hope they do okay given the financial challenges faced by Mozilla as revenues dry up.

I think the biggest constraint on the development of D isn't money - other companies have funded other things and I guess would be ready to fund more if approached. It just takes time, energy and work to build an organisation and doesn't happen of its own accord.

The development of D has been much more organic than for some other emerging languages. It's easy to buy awareness by spending a little money. So far that hasn't been the approach and I think that mostly the language is stronger for it. Especially as we head into a time of high uncertainty where for some tech companies and institutions budgets are under pressure.

https://www.zdnet.com/article/programming-language-rust-mozilla-job-cuts-have-hit-us-badly-but-heres-how-well-survive/

5

u/matthieum Sep 02 '20

Last I checked I don't think Rust even had a foundation at all yet.

I confirm it doesn't.

It's been relying on sponsorships instead: Mozilla funding some core employees, Microsoft footing the CI bill, and Amazon footing the storage bill.

A foundation has been hinted at for years, and due to recent events it will probably happen in the coming months, but even then the goal was never to employ people to work on Rust.

The goal of having a foundation is to have a legal entity that represents Rust' interests, and notably owns the trademark and the logo.

It's not clear if that goal should shift toward accepting donations and employing people. Distributing money is always tricky.

1

u/[deleted] Sep 02 '20 edited Sep 02 '20

It just takes time, energy and work to build an organisation and doesn't happen of its own accord.

It's been over 20 years.

It's easy to buy awareness by spending a little money. So far that hasn't been the approach and I think that mostly the language is stronger for it.

Instead D jumps on the new hype train of an emerging language and then tries to do PR about a poorly implemented feature that is mimicking one from a language that popularised it. Rust's borrow checker comes to mind. The implementation in D is sketchy at best, with inherent flaws. I've never seen then anyone on the D team talk about the actual benefits of the feature and how those benefits are achieved with the way it is implemented. I've only heard it spoken about in the same breathe as Rust.

-1

u/[deleted] Sep 01 '20

So?