assert semantic change proposal
via Digitalmars-d
digitalmars-d at puremagic.com
Wed Aug 6 21:02:31 PDT 2014
On Wednesday, 6 August 2014 at 22:28:08 UTC, Artur Skawina via
Digitalmars-d wrote:
> D already has `static assert`, which can be used for
> compile-time checks.
The static modifier would just be a modifier to the regular
c-style assert that basically tells the compiler to refuse to add
run-time checks.
* static assert: prove this or stop compilation
* assert: prove this or emit runtime check
* assume: define this to hold
> OTOH the extremely dangerous assert->assume redefinition seems
> to be seriously considered, despite the grave consequences...
Well, I don't worry. It just means that some people, who believe
in the concept, are going to spend a lot of effort on something
that probably does not pay off. It would be a lot better if they
rather spent some effort in adding sound annotations, like
bearophile argues for, though. It could be put it to good use by
annotating foreign functions
Keep in mind that this is an issue that is easy to fix in a
private fork. It is a small modification to turn "d-assert" into
"assume" and add a "c-assert". It requires no changes to D code?
More information about the Digitalmars-d
mailing list