Invariants for methods

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Thu Nov 18 14:25:18 PST 2010


On 11/18/10 2:02 PM, bearophile wrote:
> Andrei:
>
>> I don't see anything remotely clever in the solution I suggested.
>
> I am not clever enough...

This would be more credible if this were indeed a matter of being 
clever. It is a basic juxtaposition of ubiquitous features.

>> At some point it's worth starting to use the language to devise solutions
>> to problems instead of inventing a new feature for any problem that
>> comes about.
>
> That was not a new unexpected problem, it was an example of missing
brick of the D DbC. It's like you remove preconditions: then something
is missing in the frame. Loop invariants and loop variants are minor
feature of DbC and they probably may be spared in D (and when necessary
loop invariants may be implemented manually with a call to a pure
function), but prestate access is something I/you need often when you
want to use DbC, it's not there in Eiffel and C# for sport.
>
> Your view of how to design a language is probably different from mine.

I allowed myself to reflect a bit on the "moving average", so to say, of 
your posts, than on this particular one. That moving average reveals a 
trigger happiness about adding features instead of using existing 
features. It also reveals a consistent effort to find what other 
languages do better than D, which is good. What is missing, however, is 
taking advantage of the many things that D _does_ do well (and better 
than various other languages).

It's not impossible our views on language design differ, but that's 
nothing odd as the process and appreciating the results are highly 
subjective.


Andrei


More information about the Digitalmars-d mailing list