D now has a dangerous competitor

Bauss jj_1337 at live.dk
Thu Aug 30 16:13:21 UTC 2018


On Thursday, 30 August 2018 at 11:28:47 UTC, Basile B. wrote:
> On Thursday, 30 August 2018 at 10:57:23 UTC, bauss wrote:
>> On Thursday, 30 August 2018 at 10:43:24 UTC, Basile B. wrote:
>>> On Wednesday, 29 August 2018 at 04:53:59 UTC, bauss wrote:
>>>> On Tuesday, 28 August 2018 at 23:27:09 UTC, Nick Sabalausky 
>>>> wrote:
>>>>> [...]
>>>>
>>>> Honestly C++ did OOP somewhat right, because it wasn't 
>>>> forced upon you, but C++ itself has design issues, that I 
>>>> think D has solved very well.
>>>>
>>>> D does OOP better than C++, but D is still missing some very 
>>>> common OOP patterns.
>>>>
>>>> See: 
>>>> https://forum.dlang.org/thread/tjqxslxfxjgliyziznvk@forum.dlang.org
>>>
>>> No, that's not an issue to me, other PLs with OOP behave the 
>>> same way. Problems D has with OOP are more
>>>
>>> - not truly virtual destructors (likely a forever problem)
>>> - inherited constructors (should be solved by 
>>> https://github.com/dlang/DIPs/blob/master/DIPs/DIP1004.md)
>>
>> It's an issue with OOP, because the behavior works in 
>> literally every other OOP language. D is the only one with a 
>> different behavior and that makes it an issue.
>>
>> It might be an issue for you, but it certainly is an issue in 
>> general.
>>
>> I agree with that those are problems too though.
>
> Try Delphi, ObjFPC they also do the same as D. `protected` is 
> there for what you thing is a bug. it's conform with the module 
> system and the protections (or unit instead of module in the 
> language i mentioned before).And this is just a detail 
> anyway...just use protected.

Protected defeats the purpose of it because.

A inherits B and B inherits C.

A only accepts B to manipulate the field of A and not C.

With protected C can access it. With this fixed to have same 
behavior as other languages then C will not be able to.

D didn’t implement friends because you can access private fields 
within the same module, but it’s not possible in this scenario 
and that’s a bug.

If it shouldn’t be possible then D does need to implement friends.


More information about the Digitalmars-d mailing list