D enters Tiobe top 20

Walter Bright newshound2 at digitalmars.com
Mon Nov 11 10:39:24 UTC 2019

On 11/10/2019 2:22 AM, Timon Gehr wrote:
> On 10.11.19 00:23, Walter Bright wrote:
>> On 11/9/2019 4:23 AM, Timon Gehr wrote:
>>> You need in and out contracts for modular verification.
>> You can pick up both from looking at the assert's in the prolog and epilog of 
>> the function.
>> ...
> - Modular verification means it's enough to have DI files for functions you 
> call, without a function body.

I know.

> - Some asserts in the prologue of your function might really be asserts and not 
> assumes.

The distinction between assert and assume has come up before, and I've argued 
that in D they are the same.

> - Similarly, some asserts in the epilogue of your function might not be things 
> you actually want to guarantee to the caller.

You could look for this pattern:

   T biff(P p)
      assert(something about p);
      T result;
      scope (success) assert(something about result);

      ... function body ...

and have the contracts.

>> More importantly, nobody is working on a modular verification system for D, 
>> and haven't for 20 years, so the contracts aren't particularly useful.
> Programmers can read contracts too, not just verification systems. They are 
> useful documentation and can be used for assigning blame: Is the assertion 
> failure the fault of the caller or the callee?

I do understand the point of them. I've been enamored with contracts for 20-30 
years. I've done presentations promoting them. I added them to my C++ compiler. 
I added them to D.

I just haven't found them particularly useful or helpful when I've tried them.

More information about the Digitalmars-d mailing list