On Monday, 5 February 2018 at 22:56:47 UTC, Jonathan M Davis wrote:
On Monday, February 05, 2018 18:54:32 John Gabriele via Digitalmars-d wrote:
What is the specific purpose of -betterC? I see from <https://dlang.org/spec/betterc.html> that it's (A) useful when targeting constrained environments, and (B) for easier embedding of D libraries into larger projects. But I think I've read elsewhere in this forum that it was specifically useful for the DMD implementation itself.

Is betterC intended to be used for standalone "D -betterC" programs where C might've otherwise been used? My impression of D so far is that it can indeed already be used as a better C by avoiding the GC yourself, or invoking it yourself when appropriate.

It may be useful if that betterc.html page gave a rationale for it; to avoid any confusion on what its intended purpose is.

Based on Walter's comments, I get the impression that he thinks that the primary benefit of -betterC is to make it easier to port a C program to D, because then you can port it piece by piece rather than having to do it all at once. After that, it's D, and you can ditch -betterC and start taking advantage of the full feature set of D. Certainly, that's all that I would ever consider using -betterC for. I have zero interest in giving up on the features that require druntime. If I were going to consider that, I'd just ditch D for C++. At least then, I'd get a fully featured language even if it isn't as nice as D.

Thanks, Jonathan! Sounds like a great tool to have available to assist migrating to D.

However, there are some folks who like the idea of using -betterC as their primary or only way to use D, because they don't want the runtime for whatever reason. Some of that comes from the fact that it's easier to link against a D library from a C/C++ program when the D library doesn't require the runtime, but I don't think that that's the only reason.

Ah, I see. Around this notion then is where I'm seeing some folks here concerned about D "choosing a direction". If your impression (your first paragraph) is correct, then D has actually not changed direction (wrt betterC) in the first place.

Incidentally, this is one of those situations that reminds me how important names are, for example:

  * "D" = "the new and improved next incarnation of C/C++"
  * "-betterC" = "use this as a better (and in place of) C"

Naming is hard!

Reply via email to