assume, assert, enforce, @safe

Ary Borenszweig via Digitalmars-d digitalmars-d at puremagic.com
Thu Jul 31 12:38:39 PDT 2014


On 7/31/14, 4:34 PM, H. S. Teoh via Digitalmars-d wrote:
> On Thu, Jul 31, 2014 at 03:43:48PM -0300, Ary Borenszweig via Digitalmars-d wrote:
>> On 7/31/14, 4:37 AM, Walter Bright wrote:
>>> On 7/30/2014 4:05 PM, Ary Borenszweig wrote:
>>>> On 7/30/14, 7:01 PM, Walter Bright wrote:
>>>>> I'd like to sum up my position and intent on all this.
>>>>>
>>>>> 7. using enforce() to check for program bugs is utterly wrong.
>>>>> enforce() is a library creation, the core language does not
>>>>> recognize it.
>>>>
>>>> What do you suggest to use to check program bugs?
>>>
>>> assert()
>>
>> Then you are potentially releasing programs with bugs that are of
>> undefined behavior, instead of halting the program immediately.
>
> Isn't that already what you're doing with the current behaviour of
> assert? Not only in D, but also in C/C++.
>
>
> T
>

I don't program in those languages, and if I did I would always use 
exceptions (at least in C++). I don't want to compromise the safety of 
my programs and if they fail I want to get a clean backtrace, not some 
random undefined behaviour resulting in a segfault.


More information about the Digitalmars-d mailing list