checkedint call removal

Timon Gehr via Digitalmars-d digitalmars-d at puremagic.com
Thu Jul 31 16:49:59 PDT 2014


On 07/31/2014 09:11 PM, Walter Bright wrote:
> On 7/31/2014 7:51 AM, Tofu Ninja wrote:
>>> For example, you can have a sort function, and then at the end assert
>>> that the
>>> output of the function is sorted.
>>
>> But that is verifying that the input is sort-able....
>
> Integers are sortable, period. That is not "input".
> ...

Data types with opCmp may not be. (In fact, yours often aren't, because 
the subtraction trick does not actually work.)
The type and its opCmp are "inputs" to the 'sort' template. If it 
asserts unconditionally after sorting, some instantiations might be buggy.

>
>> All I am saying is that the idea that assert should not be used to
>> verify input
>> makes no sense at all. Every program takes in input and once a little
>> bit is in,
>> anything derived from that input is also input.
>
> You're denying the existence of mathematical identities applied to
> symbolic math.
>
>
>> Also this thread has made me firmly never want to trust assert
>> again... I have
>> actually been going though my projects and removing them now because I
>> don't
>> trust them any more...
>
> I suggest revisiting the notion of program logic correctness vs input
> verification.

You are denying the existence of standard terminology in logic and 
programming languages.


More information about the Digitalmars-d mailing list