Feedback on Átila's Vision for D

Rumbu rumbu at
Thu Oct 17 16:50:15 UTC 2019

On Thursday, 17 October 2019 at 16:26:07 UTC, Atila Neves wrote:
> On Thursday, 17 October 2019 at 15:24:09 UTC, Rumbu wrote:
>> On Thursday, 17 October 2019 at 12:51:17 UTC, Atila Neves 
>> wrote:
>>> On Wednesday, 16 October 2019 at 18:34:01 UTC, Rumbu wrote:

>>> What is it about OOP in D that you find lacking?
>> The general attitude "OOP is bad, let's use a struct instead".
> I don't know what to do about this. I prefer structs myself.

Wonderful. Then why ask in the first place?

>> The fact that objects are by default allocated using gc.
> Only if you use `new`. And if you don't, then you'll have to 
> worry about memory management.

Thank you for stating the obvious.

>> There is no language construct to use RAII or heap application 
>> on objects. We had scope but it was deprecated.
> That would be news to me. Even if `scope obj = new MyClass;` 
> got deprecated, there are library solutions.

Library solution is not a *language construct*. You know what? 
Let's deprecate 'struct'. I bet that we can build a library 
solution instead. Too many keywords, 'switch' can be reduced to a 
library solution using just 'if's.

>> The fact that class encapsulation is not fully implemented. 
>> Private is not so private.
> This is by design and isn't going to be changed. Classes can be 
> in their own module if needed.
>> Structs cannot implement interfaces (see next point for usage).
> Also by design, unless you want something like Rust's traits or 
> Haskell's typeclasses. But none of this is OOP.

Being by design, doesn't mean it's correct.

I'm starting to understand Chris.

More information about the Digitalmars-d mailing list