Eliminate assert and lazy from D?
Chris Nicholson-Sauls
ibisbasenji at gmail.com
Thu Oct 15 23:32:04 PDT 2009
Andrei Alexandrescu wrote:
> Adam D. Ruppe wrote:
>> If not, it seems kinda weird that assert() is just a lib function, but if
>> you put static before it, it becomes a completely different thing.
>
> That kinda takes the wind out of the sails of the "remove assert" ship.
>
It randomly occurred to me earlier today that one *could* implement static assert in the
library, albeit with a different (sensical) name, IF the compiler guaranteed a
pragma(halt) or pragma(exit) that prematurely terminates a compile the same way current
static assert does. Given that, a template in the library could output a custom message
with pragma(msg) and then issue the halt.
Its really just taking static assert's check expression away from it and giving it a new
name... but still. The downside is having a pragma that every compiler would actually
*have* to implement (to be worth using at least).
-- Chris Nicholson-Sauls
More information about the Digitalmars-d
mailing list