Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
A Gas Dynamics Toolkit in D (dlang.org)
95 points by pjmlp on Feb 4, 2022 | hide | past | favorite | 15 comments



The article mentions: "I think that having to use C++ Functors was about the tipping point in our 25-year adventure with C++. Ranges and the foreach loops make our D code so much tidier than our equivalent C++ code."

It almost sounds they were stuck writing C++98 code and instead of moving their coding standard to C++17, they chose to rewrite in D.


> It almost sounds they were stuck writing C++98 code and instead of moving their coding standard to C++17, they chose to rewrite in D.

I think they started their port before C++17 was standardized:

> Also in 2010, a couple of us (PAJ and RJG) living in different parts of the world (Queensland, Australia and Virginia, USA) came across the D programming language ....

> In 2014 we got serious about using D for the next iteration of Eilmer and started porting the core gas dynamics code from C++ to D. Over the next four years, ....

The grid solver, they note, was ported in 2015.


I'm glad that C++ is starting to become a useable language, too. But 25 years is enough. Asking them to wait another 12 years is a bit unreasonable.


I wonder how much of this was the change from C++ to D, and how much was simply due to the fact that they re-wrote from scratch.


I'd suspect most of the advantages were from the move away from C++, for two reasons. First, the C++ version was a rewrite of the C version. Second, they had new graduate students working on the code, not professional software developers.


My impression is that rewrites are rarely worth the effort and it's better to improve on what you have, but this is the business economics perspective. It sounds to me like this is essentially a research hobby project that kept growing? The authors have managed to keep their interest in the project by being able to rewrite the code while avoiding previously made architectural mistakes and having fun while doing it? Is this a fair take or am I underestimating the advantages? To be clear, I read the blog post and there have definitely been tangible advantages and they are still enjoying the language 6 years in so it looks like they made a good choice.


This is very clearly about a professional research project, not some hobby code a guy wrote over a few spare weekends.


> that kept growing

I don't think it started off in that polished state. Ignore the hobby if it makes it easier for you to reply to the contents of my comment.


They explicitly state that:

"This simulation program, originally called cns4u, started as a relatively small C program that ran on the Cray-Y/MP supercomputer at NASA Langley Research Center in 1991."

and the abstract for the 1991 report they link reads in part:

"The unusual features of this program are that it is written in C and makes extensive use of sophisticated data structures to encapsulate the data. The idea of writing the code this way is to make it easier than traditional FORTRAN codes to parallelize for the Multiple- Instruction-Multiple-Data style of parallel computer."

so pretty clearly it's always been a professional academic research project. This means you have severely misunderstood the context in which this code was written: they didn't maintain interest in the code because they could use a fancy language, they did it because it was integral to answering questions that they were paid to investigate and that they've dedicated decades of their life to study.


My impression is that rewrites are rarely worth the effort and it's better to improve on what you have, but this is the business economics perspective. It sounds to me like this is essentially a research project that kept growing? The authors have managed to keep their interest in the project by being able to rewrite the code while avoiding previously made architectural mistakes and having fun while doing it? Is this a fair take or am I underestimating the advantages? To be clear, I read the blog post and there have definitely been tangible advantages and they are still enjoying the language 6 years in so it looks like they made a good choice.

You seem to still be stuck on word usage, so I rewrote my comment to focus on what matters. Do you still disagree with what I write, if yes what do you disagree with?

> they didn't maintain interest in the code because they could use a fancy language, they did it because it was integral to answering questions that they were paid to investigate and that they've dedicated decades of their life to study.

Which they could have done in C++ as well since they already hade the code in C++, only it would have been a more painful process. But they could have rewrote the project in C++ as well for example, was this not a viable approach? If not, why? I believe there is a difference between research code and business code, where researchers have more freedom to choose languages that suit their projects rather than focusing on output.


The main reason is also stated:

"We were, and still are, mechanical engineers and students of gas-dynamics first and programmers second. C++ was a lot of trouble for us."

C++ is just not very fun to use if you're not a programmer.


So basically what I said. They have more fun and it keeps them interested in doing the work.


See, the content of your post is formed by the words you choose. Which other words are contradictory (or at least not necessary) to what you are trying to say? And what is it you are trying to say? It's really hard to find that out for us if you yourself aren't sure about that.


There was a whole post there, he chose to selectively focus on one word. There is not much I can do about that. What is it that you are trying to say?


What I am saying is that you were not able to formulate your thought to a concise sentence. Should be clear enough.




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: