Why assert is in the language?
michal.minich at gmail.com
Tue Jun 22 14:55:29 PDT 2010
On Tue, 22 Jun 2010 17:30:23 -0400, Steven Schveighoffer wrote:
> On Tue, 22 Jun 2010 17:07:02 -0400, Tomek Sowiński <just at ask.me> wrote:
>> Yes, why? It could be implemented in object.d in a similar fashion as
>> std.contracts.enforce. Does it do anything special that a library
>> function couldn't?
> all calls to assert are removed by the compiler in release mode. I
> don't think there's a way to implement that via a library (it would be
> nice though!)
modifying 'debug' attribute which decorate a function, which new meaning
that all calls to it are removed in release mode, might do the trick :)
it also could be useful for logging.
AFAIK, now the attribute means that the function does not exists in debug
mode, but that also means that you must mark all calls to it with 'debug'
which I don't find so much useful...
More information about the Digitalmars-d-learn