Live data from Hacker News

Why I use the D programming language for scripting (2021)

opensource.com

31–40 of 53 posts

Re: Why I use the D programming language for scripting (2021)

#32
post #19

Earlier quoted context omitted.

So it's over 20 years old yet nobody knows it exists. Doesn't sound very promising. The first time I heard of it was someone who uses it frequently complaining about too many breaking changes in minor updates. So it's unknown and unreliable. Who gives a crap if it has elegant syntax, it's just another way to write the same stuff. The examples from the article can be done in JS, python, java, c# almost exactly the sam…

I don’t think it’s fair to knock a language on rate of popularity, unless your point is community adoption. That being said, I agree with everything else you said lol. All the “elegance” in the article just reminded me of what you can achieve using Linq, or pythons list comprehension (which I personally don’t care for). I used to get excited about one-liners, but if that’s what elegance is, elegance is not important…

I think popularity implies usefulness to a degree, but I don't disagree that it might be unfair.

As for the functional approach to collection operations, I personally like it a lot. When I used Java, I used streams a lot, now that I primarily use C# I use LINQ a lot. I think in a lot of cases the syntax is more expressive and hence more readable than loops, but both have their place and both can be used badly.

Often times you can write a simple statement that does a lot of work and is very clear to the reader, assuming they are familiar with the API/paradigm. Equivalent loop implementations can be significantly more verbose which generally reduces readability. Other times a simple task can require a very convoluted functional approach whereas a loop implementation would be fairly straight forward.

As with everything there are pros and cons, they both have their niche but personally I think I use the functional approach more than I use loops these days.

Re: Why I use the D programming language for scripting (2021)

#33
I was a big fan of D, it really felt like writing the cleanest version of C ever created. If you want similar capabilities but in a language with some legs for the future, Nim is a very good choice. Some Python or Ada familiarity will make Nim feel like home.

Re: Why I use the D programming language for scripting (2021)

#34
post #23

Hope it's not seen as criticism... but I could love more elaborate examples... Checking the examples, my friction here is... why should I introduce a new language for those things? First example program equivalence: tr -s ' ' '\n' Second program equivalence: awk 'NR It takes to me more time, to understand what is doing D, even if theres is a previous explanation, that write down the equivalence with known tools. The…

What I like about D is if you already know it, it can adapt to just about anything you want, from these kind of shorter "scripts" to experimenting on bare metal to regular applications.

But yeah, if you already know ruby and python and perl and awk and the unix shell, there's not much to be gained in these examples. Just if you don't know those things and know a little D, it can meet you where you are and take you where you're going.

Re: Why I use the D programming language for scripting (2021)

#35

Earlier quoted context omitted.

Not necessarily anymore now that .NET has had a lot of enhancements for compiling to native and stripping unused references.

I think a lot of people who write off C# don't realise how much it has advanced particularly in the last few years.

You’re right - it’s why there’s comments even in HN like “you can’t run C# on Linux” and the like.

Re: Why I use the D programming language for scripting (2021)

#36

I think D is a victim of being too early - when it was announced the open source community was still obsessed with C, and D’s garbage collection was seen as an absolute show-stopper (even if the people knocking it largely didn’t try it). By the time Go came out a decade later I guess enough people had been bitten by C that garbage collection was an acceptable option (plus Google’s backing and a more complete standard…

I always thought of D as a better C++, not a better C. But at the time D showed up, C++ still showed some promise (in that sense it is right that D might have been too early, the C++ fatique hadn't set in yet for most C++ users, so why switch to D).

Re: Why I use the D programming language for scripting (2021)

#37
post #23

Hope it's not seen as criticism... but I could love more elaborate examples... Checking the examples, my friction here is... why should I introduce a new language for those things? First example program equivalence: tr -s ' ' '\n' Second program equivalence: awk 'NR It takes to me more time, to understand what is doing D, even if theres is a previous explanation, that write down the equivalence with known tools. The…

What I like about D is if you already know it, it can adapt to just about anything you want, from these kind of shorter "scripts" to experimenting on bare metal to regular applications. But yeah, if you already know ruby and python and perl and awk and the unix shell, there's not much to be gained in these examples. Just if you don't know those things and know a little D, it can meet you where you are and take you wh…

You can say that about most general purpose compiled languages. I guess I don't see why I would use D for any particular compiled use case over something like zig or rust? and if I just want to script system tasks I'm going to use popular languages with popular libraries and full batteries like python

Re: Why I use the D programming language for scripting (2021)

#38

I think D is a victim of being too early - when it was announced the open source community was still obsessed with C, and D’s garbage collection was seen as an absolute show-stopper (even if the people knocking it largely didn’t try it). By the time Go came out a decade later I guess enough people had been bitten by C that garbage collection was an acceptable option (plus Google’s backing and a more complete standard…

I think its probably that Go was being worked on by Google employees and the fact that GC languages were well accepted. A lot of early converts to Go were Python programmers, C++ devs didnt jump ship to anything else until Rust, I am seeing plenty of places integrating Rust with C++ code in some cases for mission critical code. I mean just look at when Discord switched from Go to Rust. They also used Rust to aide the…

Yeah, this matches up more with my observations as well. Go's niche is mostly in modern deployment/infrastructure management and web backends, places that historically Python might've been the premier choice.

Rust gives you better insight and control over memory management that is necessary for many of the applications that are written in C++ while offering strictly better safety guarantees and less baggage (but the tradeoff of encoding a lot of stuff in the type system). I really like Go, Rust, and Python, but all for different things.

Re: Why I use the D programming language for scripting (2021)

#39

If I write an application I use Java as I am most comfortable with it. But it is not always the best choice. If I needed to write an application for windows with a GUI I would be more successful with C# as it would look more native. If I am writing a command line tool it would be a faster and smaller application if I build it in Go, Dart or Crystal. But then I would need to be good in it as well. I like seeing these…

I feel like the Dart syntax is very very close to Java!
Post reply on HN