C's Biggest Mistake on Hacker News

Ecstatic Coder ecstatic.coder at gmail.com
Tue Jul 24 11:53:35 UTC 2018


On Tuesday, 24 July 2018 at 10:40:33 UTC, Dukc wrote:
> On Monday, 23 July 2018 at 15:06:16 UTC, Ecstatic Coder wrote:
>> And something that REALLY must be integrated into BetterC's 
>> low-level standard library in some way IMHO...
>
> They already work, except for the concatenation operator 
> because it obviously requires the GC. And converiting a pointer 
> from C code to D is easy, because you can slice pointers just 
> like arrays -it's just that it won't be bounds checked.

Nice.

But if you want D to be REALLY appealing to a majority of C++ 
developers, you'd better provide them with the FULL D experience.

And unfortunately, using builtin arrays/strings/slices/maps in 
the usual way is probably a big part for it.

Don't forget that concatenating strings in C++ is perfectly 
ALLOWED in C++, WITHOUT using a GC...

#include <iostream>

using namespace std;

int main()
{
     string str, str1, str2;
     str1 = "Hello";
     str2 = "World";
     str = str1 + " " + str2;
     cout << str << endl;

     return 0;
}

Instead of removing D's GC and the feature which rely on it, 
you'd better replace it by something which releases the unused 
memory blocks as soon as they have to be, like the reference 
counted approach used not only in C++, but also in Kotlin Native, 
Crack, etc...

THAT would make D stand above its competition, by making it more 
pleasing and enjoyable to use than C, C++ and Rust for instance 
for their typical use cases...



More information about the Digitalmars-d mailing list