C++ or D?

RSY rsy_881 at gmail.com
Thu Dec 31 07:09:28 UTC 2020


On Thursday, 31 December 2020 at 07:07:04 UTC, RSY wrote:
> On Wednesday, 30 December 2020 at 21:03:36 UTC, Paulo Pinto 
> wrote:
>> On Thursday, 24 December 2020 at 08:36:54 UTC, RSY wrote:
>>> On Wednesday, 23 December 2020 at 19:00:14 UTC, evilrat wrote:
>>>> On Wednesday, 23 December 2020 at 18:03:56 UTC, frame wrote:
>>>>>
>>>>> It's not the problem mentioned but I had to struggle with 
>>>>> DLLs and D's Variant-type. The problem is that Variant uses 
>>>>> TypeInfo which does not pass DLL boundaries correctly so 
>>>>> that int != int in runtime even it's in fact a simple int.
>>>>>
>>>>> If you need to exchange unknown data between a DLL and your 
>>>>> application you need to get a workaround and cannot use 
>>>>> that elsewhere settled nice feature. But it's a Windows 
>>>>> specific issue - it works as expected on other systems.
>>>>
>>>> Which is basically same as in C++, despite the fact it does 
>>>> have real working SO/DLL runtime's many large projects have 
>>>> their own RTTI implementation. LLVM has its own RTTI because 
>>>> standard type info is "inefficient", Unreal Engine has its 
>>>> own, IIRC Qt too has its own, etc...
>>>>
>>>> Same thing with D Variant, some people say it is 
>>>> "inefficient"... so we ended up having multiple libraries.
>>>>
>>>> Not saying anything about how good or bad all this, just the 
>>>> facts.
>>>
>>> C++ you need to write duplicate code (.h and .cpp)
>>>
>>> C++ you need to care about header include order
>>>
>>> C++ you need to forward declare everything you gonna use if 
>>> it is not included before
>>>
>>> C++ you need to waste time waiting for compile
>>>
>>
>> Fixed with C++20 modules.
>>
>> I am already playing with the experimental support on VC++.
>>
>>> C++ you need to fight to get proper reflection
>>>
>>
>> Coming in C++23, and partially available already with a mix of 
>> type traits and constexpr.
>>
>>
>> I am all good for D vs C++, but one needs to update their 
>> knowledge specially when the audience is up to date with 
>> latest ISO C++'s capabilities.
>
> and you still have the predeclaration issue, since the whole 
> process is done 1 way
>
> and this is the summary of the whole C++ has X, but it is 
> either half backed, or just plain bloated
>
> you can't say c++ will have module without saying it is 
> implemented poorly, you still have the dirty and ugly quirks
>
> D module system remains superior because the whole experience 
> is just plain superior and more sane

And you can't say C++23 will have Y therfore it is a reasonable 
choice TODAY

No, it's either you have it or you don't, everyone can implement 
Z, even Rust borrow checker, that doesn't make language 0 
relevant when you compare solutions TODAY

And even more when you take into account that D is interopable 
with both C/C++

Invalidating D, just because X Y Z will have K and have poorly 
implemented N, is very unfortunate, BAD, and plain SAD, because 
you just don't care about what D has to offer when you take into 
account the whole feature set


More information about the Digitalmars-d-learn mailing list