Feedback on Átila's Vision for D

Nicholas Wilson iamthewilsonator at
Fri Oct 18 20:34:04 UTC 2019

On Thursday, 17 October 2019 at 18:38:31 UTC, Rumbu wrote:
> On Thursday, 17 October 2019 at 17:56:03 UTC, H. S. Teoh wrote:
>> On Thu, Oct 17, 2019 at 04:50:15PM +0000, Rumbu via 
>> Digitalmars-d wrote:
>>> 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:
>>> > > There is no language construct to use RAII or heap 
>>> > > application on objects. We had scope but it was 
>>> > > deprecated.

scope class Foo { ... } was always a bit weird and too narrow a 
feature. IMO it would have been better to allow aliases to 
storage classes as a general concept

class _Foo { ... }

alias Foo = scope _Foo;

which I have has to hack LDC to do for `__gshared`.

>>> > 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.
>> Why does it have to be a language construct? Please explain.
> Because library solutions are workarounds and don't highlight 
> any language design commitment. Using library solutions, I can 
> make D look like Brainfuck if I insist. But this doesn't mean 
> that D is Brainfuck. Keep in mind that the original question 
> was why I consider OOP a second hand citizen in D language. I 
> fact the outcome of the discussion does nothing else than 
> strongly support my opinion: I need a library solution to do 
> OOP in D.

What I think was lost in the chain is that it is entirely 
possible to do

auto foo = Structify!MyClass(args);

as a counterpart to

scope obj = new MyClass;

More information about the Digitalmars-d mailing list