www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Top 3 use cases for D

reply Imperatorn <johan_forsberg_86 hotmail.com> writes:
In your opinion, what is the selling point of D, the top 3 use 
cases where D would be a nice fit?

D has struggled to find a niche (because it's so flexible?), but 
is that also why it hasn't seen wider adoption?

What do you think are the top 3 places where you think "I could 
use D here instead of {language} because {reasons}"?
Sep 27
next sibling parent reply "H. S. Teoh" <hsteoh qfbox.info> writes:
On Fri, Sep 27, 2024 at 06:49:27PM +0000, Imperatorn via Digitalmars-d wrote:
 In your opinion, what is the selling point of D, the top 3 use cases
 where D would be a nice fit?
The top selling point of D for me is that it's easy to write working code in D. My typical development times are much shorter in D compared with equivalent code in C/C++/Java. D also has very nice built-in features, like unittests, which in spite of whatever warts they may have make it easy to develop correct, working code. In C/C++ I'd have to spend inordinate amounts of time debugging the code after writing it, and in other languages I'd have to resort to external test frameworks, which add to the inertia of being too lazy to actually do it. My current actual (not hypothetical!) use cases for D are: - A handy shell-script replacement that has none of the shell's irritating points (like greedy string interpolation, that leads to needless fragility and Leaning Toothpick Syndrome, plus I can get parallization almost for free with almost no effort). - Quick prototyping of programs that do complex computations -- because D has so many boilerplate-reducing features that makes it possible to try out new ideas quickly without drowning in boilerplate (like Java is wont to do). Many of these prototypes can be easily turned into real applications relatively painlessly -- because D is just so flexible that refactoring is almost always a breeze. Built-in unittests ensure refactorings don't introduce too many breakages in the transition. - Workhorse programs that I use repeatedly: because D's features make maintenance relatively easy, and adding new features often doesn't require major refactorings like the equivalent C/C++ projects often require IME.
 D has struggled to find a niche (because it's so flexible?), but is
 that also why it hasn't seen wider adoption?
I'd say the small- to medium-sized application zone is where D excels the most at. For larger applications I can't really say, haven't had too much experience in that area, but based on what I know, in a larger application that may depend on external libraries, finding said libraries may be a problem. I generally have to resort to writing my own wrappers for C APIs to call external libraries with. It's workable, but maintenance is a bit of a pain when the external APIs change.
 What do you think are the top 3 places where you think "I could use D
 here instead of {language} because {reasons}"?
I'm already using D instead of shell scripts, because D is just so much better at dealing with data manipulations than hacking the equivalent functionality with sed, awk, grep, and expr. I'm also using D instead of Perl scripts these days, because Perl is just not very maintainable once you get past a certain level of complexity (which is not very high). And I'm definitely using D instead of C/C++ in my personal projects, because it just takes far too much effort to implement things in C/C++ and afterwards it takes far too much effort to debug. In spite of its warts, D does much better in this area IME than C/C++. // Having said that, though, I'm still hesitant to introduce my C/C++-minded colleagues to D, because their first reaction would be GC-phobia, and their second reaction would be "who uses this unknown language?", and their third reaction would be "are you sure we want company products to depend on such a small unknown team?". I've no interest in participating in this fashion show, so I'm not even going to bother. On the more technical side, things like shared, which "does what it's designed to do" but nevertheless obviously screams "incomplete solution" to an outsider, or dip1000 that nobody can explain in 2 sentences before would-be adopters glaze over in their eyes, or the absence of read/write barriers that would have given us a modern, generational GC instead of the conservative compromise we have today -- these just don't look good to a newcomer. And the attribute soup looks scarier and scarier every time we attempt to fix it. Plus a ton of peripheral half-baked features that were never completed, or were completed but don't present a comprehensive solution, I honestly wouldn't know how to answer if someone asked me "why has feature X been like this for Y many years, and what are you guys doing about it?". T -- People who are more than casually interested in computers should have at least some idea of what the underlying hardware is like. Otherwise the programs they write will be pretty weird. -- D. Knuth
Sep 27
parent andy <andy example.org> writes:
On Friday, 27 September 2024 at 19:15:36 UTC, H. S. Teoh wrote:
 Quick prototyping of programs
The runnable unit-tests in the docs make exploration of the stdlib very fast. This is almost ten percent as good as a REPL, which is much better than what most compiled languages offer.
 I'd say the small- to medium-sized application zone is where D 
 excels the most at.
It definitely has some competitive advantages that are most apparent in this zone. Some small nits that would help here: Integrated unittests already help a lot, but I wish one of the popular unittest frameworks were included in the stdlib to make it zero-friction. Tuples and sumtypes are important QoL features that are missing for me that would reduce boilerplate and increase expressiveness for the straightforward data-transformation programs.
Sep 29
prev sibling next sibling parent Lance Bachmeier <no spam.net> writes:
On Friday, 27 September 2024 at 18:49:27 UTC, Imperatorn wrote:
 In your opinion, what is the selling point of D, the top 3 use 
 cases where D would be a nice fit?
Who are you selling to? That question only makes sense in the context of a specific application.
 D has struggled to find a niche (because it's so flexible?), 
 but is that also why it hasn't seen wider adoption?
Those are two different things. D has at least one wildly successful niche in interacting with C code. That is unlikely to result in wide adoption because that requires replacing Java, C++, Python, etc. Working well with C is nice but not helpful in getting on the front page of Hacker News because of some startup that's using it.
 What do you think are the top 3 places where you think "I could 
 use D here instead of {language} because {reasons}"?
Scripting and data analysis are two. Those are often done with one or a small number of programmers.
Sep 27
prev sibling next sibling parent Serg Gini <kornburn yandex.ru> writes:
On Friday, 27 September 2024 at 18:49:27 UTC, Imperatorn wrote:
 In your opinion, what is the selling point of D, the top 3 use 
 cases where D would be a nice fit?

 D has struggled to find a niche (because it's so flexible?), 
 but is that also why it hasn't seen wider adoption?

 What do you think are the top 3 places where you think "I could 
 use D here instead of {language} because {reasons}"?
Hobby projects Testing ideas for compiler Testing ideas for meta programming
Sep 27
prev sibling next sibling parent Bastiaan Veelo <Bastiaan Veelo.net> writes:
On Friday, 27 September 2024 at 18:49:27 UTC, Imperatorn wrote:
 In your opinion, what is the selling point of D, the top 3 use 
 cases where D would be a nice fit?

 D has struggled to find a niche (because it's so flexible?), 
 but is that also why it hasn't seen wider adoption?
I think not having a niche is a reason why it hasn't seen wider adoption. Also, not having a niche is what makes D attractive to us; Plus its many strong points. The top three use cases for us are replacing Pascal for number crunching, desktop applications and networking. -- Bastiaan.
Sep 30
prev sibling next sibling parent Mike Shah <mshah.475 gmail.com> writes:
On Friday, 27 September 2024 at 18:49:27 UTC, Imperatorn wrote:
 In your opinion, what is the selling point of D, the top 3 use 
 cases where D would be a nice fit?

 D has struggled to find a niche (because it's so flexible?), 
 but is that also why it hasn't seen wider adoption?

 What do you think are the top 3 places where you think "I could 
 use D here instead of {language} because {reasons}"?
D is a productive systems language. 1. It's great for scripting (it's replace my Python, because the D language scales well as my scripts inevitably grow into full programs) 2. It's great for graphics/game programming (speed of compiled code, and language is malleable to allow redesign after prototyping) 3. I've also used D for network programming (slicing into bits, and using metaprogramming for serialization is a breeze)
Sep 30
prev sibling next sibling parent reply Atila Neves <atila.neves gmail.com> writes:
On Friday, 27 September 2024 at 18:49:27 UTC, Imperatorn wrote:
 In your opinion, what is the selling point of D, the top 3 use 
 cases where D would be a nice fit?
1. Everything. 2. Everything. 3. Everything. :P
 D has struggled to find a niche (because it's so flexible?), 
 but is that also why it hasn't seen wider adoption?
I think that's probably part of it. It can do nearly anything.
 What do you think are the top 3 places where you think "I could 
 use D here instead of {language} because {reasons}"?
Subjectively, because D is the language that annoys me the least. Objectively, because I write less code with fewer bugs that does a lot more. In what other language can I write a dub package* that autowraps D code so it can be called in Excel and/or Python in two lines, one of which is an import?? * https://github.com/symmetryinvestments/autowrap
Sep 30
parent reply Araq <rumpf_a web.de> writes:
On Tuesday, 1 October 2024 at 02:56:11 UTC, Atila Neves wrote:

 Subjectively, because D is the language that annoys me the 
 least. Objectively, because I write less code with fewer bugs 
 that does a lot more. In what other language can I write a dub 
 package* that autowraps D code so it can be called in Excel 
 and/or Python in two lines, one of which is an import??

 * https://github.com/symmetryinvestments/autowrap
In any language with a decent macro system: Nim and probably Rust, Elixir and Julia...
Oct 08
parent Atila Neves <atila.neves gmail.com> writes:
On Tuesday, 8 October 2024 at 20:07:38 UTC, Araq wrote:
 On Tuesday, 1 October 2024 at 02:56:11 UTC, Atila Neves wrote:

 Subjectively, because D is the language that annoys me the 
 least. Objectively, because I write less code with fewer bugs 
 that does a lot more. In what other language can I write a dub 
 package* that autowraps D code so it can be called in Excel 
 and/or Python in two lines, one of which is an import??

 * https://github.com/symmetryinvestments/autowrap
In any language with a decent macro system: Nim and probably Rust, Elixir and Julia...
In Rust's case, at least, it would be a lot more code, and a lot more complicated. In D it's straightforward imperative code. C++ is turing-complete at compile-time just as well as D is. But a lot harder to do.
Oct 08
prev sibling next sibling parent Kagamin <spam here.lot> writes:
On Friday, 27 September 2024 at 18:49:27 UTC, Imperatorn wrote:
 In your opinion, what is the selling point of D, the top 3 use 
 cases where D would be a nice fit?
a superior choice for that. I would use D for everything else.
 What do you think are the top 3 places where you think "I could 
 use D here instead of {language} because {reasons}"?
I found my current use of D is governed by legacy: I wrote enough D code for D to be useful. If I am to use another language I'll need to write this code again and probably also redesign it to fit the new language.
Sep 30
prev sibling next sibling parent Dejan Lekic <dejan.lekic gmail.com> writes:
On Friday, 27 September 2024 at 18:49:27 UTC, Imperatorn wrote:
 In your opinion, what is the selling point of D, the top 3 use 
 cases where D would be a nice fit?

 D has struggled to find a niche (because it's so flexible?), 
 but is that also why it hasn't seen wider adoption?

 What do you think are the top 3 places where you think "I could 
 use D here instead of {language} because {reasons}"?
1) Small hobby projects 2) Education 3) Quick snippets
Oct 01
prev sibling next sibling parent MrJay <mrjcraft2021 gmail.com> writes:
On Friday, 27 September 2024 at 18:49:27 UTC, Imperatorn wrote:
 In your opinion, what is the selling point of D, the top 3 use 
 cases where D would be a nice fit?

 D has struggled to find a niche (because it's so flexible?), 
 but is that also why it hasn't seen wider adoption?

 What do you think are the top 3 places where you think "I could 
 use D here instead of {language} because {reasons}"?
I dont know what it would be useful for in the wider context of software development I will just explain my use case. I work in a fast paced industry where there are new things every single week, its art based and I need to write scripts to generate things very quickly they are one off and never used again, D is better for this than most other languages the only languages I found that were better for scripting were languages like Common lisp, scheme, and julia, languages like that are fast to write and fast to run. (obviously not including libraries otherwise python would be the best, as I prefer to write the code and not use libraries) my second use case is long term production code for generating things for work, it needs to work for a long time, and be extended with scripts in emergencies, the production code also needs to be graphical at least at some point. D is the only language I have found that allows me to do both the scripting workflow and production workflow in one language, every single other language I have tried has some major barrier, I checked dozens of programming languages, most have obvious issues where I didnt need to write any code to see it wasnt useful, like I refuse to use an interpreted language, or were too new for me to trust as I am going to be using the language for many years. I think one reason people dont use D is because its good at everything, its good at scripting and production code, but for scripting its not as good as other languages, and for production code its not as good as other languages, most people are extreme in either of those directions, few people want balance, thus why they use Rust or Go for production, and python for scripting. realistically I think its easy to prove its a dumb approach as many companies have spent millions of dollars re writing there python back-ends in faster languages, if they would have used D it literally would have saved millions of dollars, it should be an easy sell, D will save you money because worse case scenario you can always make your code faster, if you cant its a problems with your skills, not the language. so to answer your questions D's best niche at least in my opinion is any situation where its a good idea to write a script first and write production code later, which is virtually everything.
Oct 01
prev sibling parent reply Chris Piker <chris hoopjump.com> writes:
On Friday, 27 September 2024 at 18:49:27 UTC, Imperatorn wrote:
 In your opinion, what is the selling point of D, the top 3 use 
 cases where D would be a nice fit?

 D has struggled to find a niche (because it's so flexible?), 
 but is that also why it hasn't seen wider adoption?

 What do you think are the top 3 places where you think "I could 
 use D here instead of {language} because {reasons}"?
1. Avoid split language development in Python + C 2. Deploy self-contained binaries without the need for a separate 3. Have technical problems solved by a small focused community instead of working in a language where you're too unimportant to consider (all the big players). My major reason for trying out D in the first place was to move away from split language development in Python + C. I wanted something with brevity of Python, the speed of C but with a full-featured standard library. I didn't need a GUI, because I mostly write server-side processes. While searching around I tried Rust, D and Go and settled on D. I had spent about 5 years as a C++ developer, and some time writing Java so the overall syntax felt familiar and the garbage collector sealed the deal. Finally as an experienced developer, I wanted a toolset and community that didn't preach about the "One Right Way" to program, but just provided support for whatever I was trying to do. D's flexibility is one of it's best features from my point of view. In my own personal opinion, the major draw back of D was that the standard library contained no GUI widgets. Yes there were libraries, but unlike Java Swing, there was nothing officially maintained and distributed as part of the core toolset. To me, this was a major problem and why D remained a niche language among work-a-day programmers. These days Javascript has taken over as everyone's GUI dev language, so it doesn't matter as much, but it certainly would have helped adoption during the 2005 - 2015 decade.
Oct 18
parent reply Lance Bachmeier <no spam.net> writes:
On Friday, 18 October 2024 at 20:06:42 UTC, Chris Piker wrote:

 In my own personal opinion, the major draw back of D was that 
 the standard library contained no GUI widgets. Yes there were 
 libraries, but unlike Java Swing, there was nothing officially 
 maintained and distributed as part of the core toolset. To me, 
 this was a major problem and why D remained a niche language 
 among work-a-day programmers. These days Javascript has taken 
 over as everyone's GUI dev language, so it doesn't matter as 
 much, but it certainly would have helped adoption during the 
 2005 - 2015 decade.
Sure, D didn't distribute Tk like some scripting languages have been doing for a long time, but it was very easy to use. It's hard to imagine that being a dealbreaker. The programmers would have still needed to get approval from their managers.
Oct 18
parent reply Chris Piker <chris hoopjump.com> writes:
On Saturday, 19 October 2024 at 03:13:02 UTC, Lance Bachmeier 
wrote:
 Sure, D didn't distribute Tk like some scripting languages have 
 been doing for a long time, but it was very easy to use. It's 
 hard to imagine that being a dealbreaker. The programmers would 
 have still needed to get approval from their managers.
Since my perspective is limited to the environments I know, and I've never worked in industry, I wouldn't presume to claim any expertise in that arena. However in academia, teams are often rather small and independent work is encouraged. A single person can demonstrate something quite useful on their own volition. Since demonstrating something useful often involves a GUI, it's nice to have one come along for the ride. Almost all rapid prototyping environments provide some GUI capability (ex: MATLAB) and I see engineers and students whipping up reasonable tools using them all the time. D lends itself to rapid prototyping, but does not have a simple included GUI lib. While not a deal breaker, it's a hindrance. Little bits of friction add up, and eventually the cart stops. Conversely, little bits of thrust also add up, and thinking back to my early days as a programmer, I happen to think this particular addition would have helped D take off. Anyway, it's all academic at this point. Right now some sort of javascript bindings may be far more important since browsers are everyone's favorite GUI environment, and javascript can be really slow for some operations.
Oct 20
parent reply Mike Shah <mshah.475 gmail.com> writes:
On Sunday, 20 October 2024 at 20:51:41 UTC, Chris Piker wrote:
 On Saturday, 19 October 2024 at 03:13:02 UTC, Lance Bachmeier 
 wrote:
 [...]
Since my perspective is limited to the environments I know, and I've never worked in industry, I wouldn't presume to claim any expertise in that arena. However in academia, teams are often rather small and independent work is encouraged. A single person can demonstrate something quite useful on their own volition. Since demonstrating something useful often involves a GUI, it's nice to have one come along for the ride. Almost all rapid prototyping environments provide some GUI capability (ex: MATLAB) and I see engineers and students whipping up reasonable tools using them all the time. D lends itself to rapid prototyping, but does not have a simple included GUI lib. While not a deal breaker, it's a hindrance. Little bits of friction add up, and eventually the cart stops. Conversely, little bits of thrust also add up, and thinking back to my early days as a programmer, I happen to think this particular addition would have helped D take off. Anyway, it's all academic at this point. Right now some sort of javascript bindings may be far more important since browsers are everyone's favorite GUI environment, and javascript can be really slow for some operations.
To some degree I thought GTK had become a default GUI library for many folks. There's several tutorials here otherwise: https://gtkdcoding.com/ Perhaps something for Phobos3 to consider otherwise -- it's a big project, but maybe a few simple widgets to start could do the trick.
Oct 20
next sibling parent reply Chris Piker <chris hoopjump.com> writes:
On Sunday, 20 October 2024 at 22:05:45 UTC, Mike Shah wrote:
javascript can be really slow for some operations.
 To some degree I thought GTK had become a default GUI library 
 for many folks.

 There's several tutorials here otherwise: 
 https://gtkdcoding.com/
Oh, never been to that page, didn't know it existed. Thanks for the tip! Though, when I go there I don't see any instructions on how to "install" gtkd.
 Perhaps something for Phobos3 to consider otherwise -- it's a 
 big project, but maybe a few simple widgets to start could do 
 the trick.
I think it's just a packaging / promotion issue. Right now if I install dmd on Windows I get a compiler and a package manager. Nice enough, and a great start. But a new user is left to google stack overflow to find out how to make a simple GUI. I just flipped through all the pages in the DLang tour and none of the them mention how you might get a window on the screen to display your output. There are nice sections on vibe.d and mir, but nothing for graphical output. That seems a bit odd on the surface. A couple years ago I had to make a simple test control program for a lab apparatus we designed. There were many environments to chose from. I ended up selecting python because TK + matplotlib provided all the GUI portions that we needed to keep a technician from getting confused. Python provided beautiful plots, but ended up being somewhat of a pain because it's not easy to multi-thread and couldn't keep up with sensor output over a USB-C port, so C handled data collection. Would have been nicer to do everything in D, though I don't know what data plotting libs are recommended. Anyway, D's a small community so selecting one windowing wrapper (SDL maybe?) and promoting it for simple jobs could be useful. Right now there are multiple projects but none has the guarantee of longevity that dmd and dub have. I presume something that's also useful for the embedded development crowd would be a good choice.
Oct 20
parent Sergey <kornburn yandex.ru> writes:
On Monday, 21 October 2024 at 03:51:05 UTC, Chris Piker wrote:
 over a USB-C port, so C handled data collection.  Would have 
 been nicer to do everything in D, though I don't know what data 
 plotting libs are recommended.
Some popular interfaces: R's ggplot (based on Cairo) (https://code.dlang.org/packages/ggplotd) Python's matplotlib (still need python installed) (https://code.dlang.org/packages/matplotlib-d) But their capabilities are quite limited afaik. So maybe consider to make plot in external library, or prepare some bindings.
Oct 21
prev sibling parent reply Dejan Lekic <dejan.lekic gmail.com> writes:
On Sunday, 20 October 2024 at 22:05:45 UTC, Mike Shah wrote:
 To some degree I thought GTK had become a default GUI library 
 for many folks.

 There's several tutorials here otherwise: 
 https://gtkdcoding.com/

 Perhaps something for Phobos3 to consider otherwise -- it's a 
 big project, but maybe a few simple widgets to start could do 
 the trick.
I still use GtkD for my personal GUI stuff. Sadly that project is dead. I am not surprised as maintaining, supporting and improving it takes lots of time. One person simply can't do it. Kudos to Mike for doing this for years... GUI toolkit should not be in Phobos in my humble opinion, but it must be one of the "core" projects supported by the D Language Foundation. Many people think it can be done by one or two persons, but they have no idea how wrong they are...
Oct 21
parent reply Chris Piker <chris hoopjump.com> writes:
On Monday, 21 October 2024 at 09:43:12 UTC, Dejan Lekic wrote:
 GUI toolkit should not be in Phobos in my humble opinion, but 
 it must be one of the "core" projects supported by the D 
 Language Foundation. Many people think it can be done by one or 
 two persons, but they have no idea how wrong they are...
I think that's totally reasonable as well. I'm used to Java and Python but the closer analogy is probably C++. Even if a main GUI lib were separate from phobos, having one go-to option with the similar standards of care and feeding as phobos that would be nice. My initial opinion was that DWT is favored option (since it has it's own forum section) but everyone seems to be using something else. Anyway I'll hop over to another thread to continue this, don't want to dilute this one too much.
Oct 21
parent Sergey <kornburn yandex.ru> writes:
On Monday, 21 October 2024 at 17:13:18 UTC, Chris Piker wrote:
 be nice.  My initial opinion was that DWT is favored option 
 (since it has it's own forum section) but everyone seems to be 
 using something else.
Yeah, it’s confusing, but I think it is not a thing. Just nobody care to maintain forum too much
Oct 21