Why is D unpopular

Paulo Pinto pjmlp at progtools.org
Mon Jun 13 10:49:37 UTC 2022


On Monday, 13 June 2022 at 09:12:47 UTC, user1234 wrote:
> On Monday, 13 June 2022 at 09:09:08 UTC, user1234 wrote:
>> On Monday, 13 June 2022 at 08:13:14 UTC, claptrap wrote:
>>> [...]
>>
>> True but ObjFPC has `strict private` too since a while: [demo].
>> This does exactly what is discussed on the D forum since a 
>> week.
>>
>> [demo]: https://ideone.com/j0kCMD
>
> well the online compilers are too old, but if you try this code 
> with a more recent compiler
>
> ```pascal
> {$MODE OBJFPC}{$H+}
> {$MODESWITCH ADVANCEDRECORDS}
> type TS = record
>   private
>     a: integer;
>   strict private
>     b: integer;
> end;
>
> var
>  s: TS;
>
> begin
>   s.a := 1; // OK
>   s.b := 1; // NG
> end.
> ```
>
> this gives
>
>> project1.lpr(15,5) Error: identifier idents no member "b"

You should have used compiler explorer. :)

https://godbolt.org/z/6M7be7M57


More information about the Digitalmars-d mailing list