August 25, 2017
On Thursday, 24 August 2017 at 18:26:37 UTC, H. S. Teoh wrote:

>> For instance, a D project targeting STM board, makes heavy use of classes and templates, resultant code segment is 3k.
>> 
>> https://github.com/JinShil/stm32f42_discovery_demo#the-good

> To be fair, though, the above-mentioned project did have to create a stub druntime in order to get things to work.  Not everyone may have the know-how required to construct a minimal druntime that works for their purposes.

Those runtime stubs are needed precisely because of problems in D's implementation.  If the implementation were fixed, none of those stubs would be required, and neither would the -betterC switch.

Because the project above is not using any feature provided by those runtime stubs, those stubs should not be required, and neither should the -betterC switch.

GDC has made some improvements here, and that is why the project above only compiles with GDC.

LDC doesn't even display an error message when those stubs aren't created.  Instead it enters a codegen loop generating a gargantuan multi-gigabyte file, ultimately crashing my VM (https://github.com/ldc-developers/ldc/issues/781).

Sometimes, however, it is not known whether a runtime feature will be needed until link-time.  In that case, it's OK for the compiler to emit TypeInfo, ModuleInfo, etc..., but it should do so in a way that the linker (with either LTO or --gc-sections) can determine what is needed and what isn't and discard that which isn't needed.  Once unneeded object code is discarded, the linker errors disappear, and you get a functioning executable without linking in the runtime and without a -betterC switch.

GDC recently implemented such an improvement (https://github.com/D-Programming-GDC/GDC/pull/505).  It brought my binary size from 600kB to 6KB, so now I can get back to microcontroller programming in D.  This is the kind of work that's needed.

Mike



August 25, 2017
On Thursday, 24 August 2017 at 19:21:31 UTC, Walter Bright wrote:
> On 8/24/2017 11:56 AM, Walter Bright wrote:
>>> I find -betterC to be somewhat of a copout for avoiding the hard work of improving D's implementation.
>> 
>> On the contrary, I view it as providing motivation for dealing with those issues. The PR above is stalled for lack of motivation.
>
> -betterC also brings into sharp focus exactly what the issues are.

Great! I look forward to seeing improvements and hope to help.

Allow me to point out a recent pull request that should have resulted in an improvement in the full-featured D implementation rather than the -betterC implementation.

https://github.com/dlang/dmd/pull/6918

DMD should never link in Phobos or druntime automatically. Rather, I think such dependencies should be specified on a platform-by-platform basis using a dmd.conf, linker script, or some other configuration file that is distributed with the toolchain's package.

This puts the power in the hands of the user to avoid linking in Phobos and druntime without having to use the -betterC switch which is especially useful if the user is providing their own minimal runtime implementation to support features of D that are excluded with the heavy hand of -betterC.

Mike
August 25, 2017
On Thursday, 24 August 2017 at 19:09:58 UTC, Parke wrote:
> What is "intermediate D"?

D with minimal runtime.
August 25, 2017
On Friday, 25 August 2017 at 08:54:02 UTC, Kagamin wrote:
> On Thursday, 24 August 2017 at 19:09:58 UTC, Parke wrote:
>> What is "intermediate D"?
>
> D with minimal runtime.

How to pass to dub -betterC flag?
August 25, 2017
On Friday, 25 August 2017 at 09:50:39 UTC, Suliman wrote:
> On Friday, 25 August 2017 at 08:54:02 UTC, Kagamin wrote:
>> On Thursday, 24 August 2017 at 19:09:58 UTC, Parke wrote:
>>> What is "intermediate D"?
>>
>> D with minimal runtime.
>
> How to pass to dub -betterC flag?

{
    ...
    "dflags" : ["betterC"],
    ...
}
August 25, 2017
On Friday, 25 August 2017 at 10:01:25 UTC, Basile B. wrote:
> On Friday, 25 August 2017 at 09:50:39 UTC, Suliman wrote:
>> On Friday, 25 August 2017 at 08:54:02 UTC, Kagamin wrote:
>>> On Thursday, 24 August 2017 at 19:09:58 UTC, Parke wrote:
>>>> What is "intermediate D"?
>>>
>>> D with minimal runtime.
>>
>> How to pass to dub -betterC flag?
>
> {
>     ...
>     "dflags" : ["betterC"],
>     ...
> }

oooooooooooooops, add the hyphen before, so

{
    ...
    "dflags" : ["-betterC"],
    ...
}



August 25, 2017
On Friday, 25 August 2017 at 08:54:02 UTC, Kagamin wrote:
> On Thursday, 24 August 2017 at 19:09:58 UTC, Parke wrote:
>> What is "intermediate D"?
>
> D with minimal runtime.

5 years later...

D - BetterC++ (no gc)
D - BetterJava (full on gc + other goodie tissue)
D - BetterRust (full interoperability with rust)

Forgive my cynicism
August 25, 2017
> On Thursday, 24 August 2017 at 19:09:58 UTC, Parke wrote:
>> What is "intermediate D"?

On Fri, Aug 25, 2017 at 1:54 AM, Kagamin via Digitalmars-d-announce <digitalmars-d-announce@puremagic.com> wrote:
> D with minimal runtime.

Is there any documentation on how to access and use the minimal runtime?

-Parke
August 25, 2017
On Friday, 25 August 2017 at 15:29:54 UTC, Swoorup Joshi wrote:
> On Friday, 25 August 2017 at 08:54:02 UTC, Kagamin wrote:
>> On Thursday, 24 August 2017 at 19:09:58 UTC, Parke wrote:
>>> What is "intermediate D"?
>>
>> D with minimal runtime.
>
> 5 years later...
>
> D - BetterC++ (no gc)
> D - BetterJava (full on gc + other goodie tissue)
> D - BetterRust (full interoperability with rust)
>
> Forgive my cynicism

D - BetterC# (no simple and easy-to-use generics, complex templates instead)
Phobos - Better.NET (pointless names, weird structure, outdated stuff)
DCD - BetterIntelliSense (tends to always not find about ~10 of all real possibilities, is rather "patched into" IDEs/editors than integrated)
August 25, 2017
On Friday, 25 August 2017 at 00:24:14 UTC, Michael V. Franklin wrote:
> On Thursday, 24 August 2017 at 19:21:31 UTC, Walter Bright wrote:
>> [...]
>
> Great! I look forward to seeing improvements and hope to help.
>
> [...]

i believe that should be an opt-out. what about newcomers? will they have to learn how to link std lib?