Feedback on Átila's Vision for D

Paul Backus snarwin at gmail.com
Thu Oct 17 20:10:45 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:
>> 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.
>
>> 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.
>
>> 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.
>
>> 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.

It's really disappointing to me how poor the communication is on 
both sides of this exchange.

- On Rubmu's side, the complaints are expressed in a way that 
makes it hard to understand what the actual problems are that 
he's encountered using D.
- On your side, Átila, the responses seem to be aimed primarily 
at dismissing or invalidating Rumbu's complaints, rather than 
attempting to understand them or asking for clarification.

There's a lot that could be improved here. Since you, Átila, are 
the one in a position of authority, you have a much greater 
opportunity to set a constructive tone for conversations like 
these going forward, so I'll focus your responses.

- It's true that a complaint about "general attitude" is not 
actionable. Instead of dismissing it, however, you could take the 
opportunity to ask for clarification. For example: is there a 
specific improvement to D that you'd like to see given a higher 
priority?

- It's true that D provides several alternatives to `new` and the 
GC for heap allocation, but it's likely that Rumbu wouldn't be 
making this complainy if those alternatives already solved his 
problems. Again, there's an opportunity here to ask clarifying 
questions: have you tried D's current alternatives to `new`? If 
not, why not? If so, are there specific ways in which you'd like 
to see them improved?

- It's true that class-level encapsulation can be achieved using 
D's module system, but it's not obvious, and it requires extra 
work. Possible follow-up questions: have you tried using the 
proposed solution of putting classes in their own modules? If 
not, why not? If so, did you run into any issues with it?

- It's true that structs can't implement interfaces, but there 
are reasons why someone might want them to. You might ask: what 
problems has this limitation caused you? Have you tried any of 
the existing library solutions, like `std.typecons.wrap`?

Don't take this harshly--effective communication is really, 
really difficult. Most people, including myself, get it wrong 
most of the time. It takes a lot of time, effort, and practice. 
If you can manage it, though, the rewards are huge: people will 
feel understood and listened-to when they talk to you, and you'll 
be able to avoid pointless arguments and focus on actually 
getting stuff done.


More information about the Digitalmars-d mailing list