Property discussion wrap-up

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Mon Jan 28 07:44:30 PST 2013


On 1/28/13 9:06 AM, Dicebot wrote:
> On Monday, 28 January 2013 at 13:49:14 UTC, Andrei Alexandrescu wrote:
>> But this gets back to faith-based programming. I associate "reasoning"
>> with much more rigorous processes.
>
> System-level programming is a lot about faith-based programming. I.e.
> you have some faith that "writeln" won't modify some random functions
> instructions at run-time, despite it possibly could have done it. This
> is very reason to push for idiomatic code and discipline when working
> with few million loc of system code - otherwise things might just blow
> up from any seemingly innocent action.

But D aims at general-purpose programming with only tidbits of 
systems-level code. The pure and @safe features are intended to enable 
actual reasoning (in the rigorous sense) on portions of programs or 
entire programs.

> Compiler may help here or may not. Strict and well-defined property
> enforcement helps. Lax parens-les chaos leaves you no place for trust
> and forces either to spent much more time to maintain code or resort to
> verbal project-level restrictions and external verification tools.
>
>>
>>> That is why having .length of array as a property that reallocates is so
>>> horrible.
>>
>> Well it's worked hasn't it.
>
> If anyone can give me a language with half D features but with this part
> done right - I ll switch immediately. I have no other candidates though
> and am doomed to sit tight and suffer. Makes me rage every time I see it
> though. Recently another example of wrong property usage was given:
> range.save
>
> Phobos is kind of fucked up in this regard.

I understand how you feel though you probably are overstating it. No 
language can please everyone, and nobody will be pleased by all aspects 
of a language.


Andrei


More information about the Digitalmars-d mailing list