Improving assert-printing in DMD

Andrei Alexandrescu via Digitalmars-d digitalmars-d at puremagic.com
Thu Oct 1 07:37:54 PDT 2015


On 10/01/2015 04:46 AM, John Colvin wrote:
> Checks involving sensitive data after processing can definitely be a
> check of program logic.
>
> Sensitive data enters program
> Sensitive data is checked using enforce
> Sensitive data is passed to another function, but something goes wrong
> (not enough checking before, wrong function called, HDD dies, someone
> trips over a network cable), an assert is triggered, the sensitive data
> spills to stderr.

I think worrying about this would be an exaggeration.

> At the very least there should be a compiler switch to turn
> assert-printing on/off

Please, no. Keep it simple and automatic. Zero-work improvement for the 
client.

Printing good messages in assertions is a good idea. For most ideas of 
sufficient complexity, situations can be imagined in which there are 
disadvantages. It has happened before in our community that good ideas 
didn't get worked on because a few folks dwelt on the disadvantages with 
too much vividness.

Whoever wants to work on better assert expression printing: make sure 
you specify which grammar constructs are supported, and how the parts 
involved are printed. Expressing semantics via lowering would be great. 
Write a DIP, discuss, implement. I'll have your six.


Andrei


More information about the Digitalmars-d mailing list