[Issue 17424] Add optional errors/static analysis

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Fri May 26 02:11:08 PDT 2017


https://issues.dlang.org/show_bug.cgi?id=17424

--- Comment #6 from Eyal <eyal at weka.io> ---
(In reply to Jonathan M Davis from comment #5)
> I would point out that optional errors would actually be extremely bad in D
> because of compile-time introspection. What code worked and compiled would
> change based on the compiler flags, effectively meaning that the language
> definition changed via the compiler flags. We already have problems with
> that thanks to -w (we really should just be made to do the same as -wi and
> then phase one of them out). To get the diagnostics that you're looking for
> without creating problems with compile-time introspection, there would need
> to be some sort of option that caused compilation to fail (as occurs with an
> error) when they occurred but which would be ignored for the purposes of
> compile-time introspection.

The introspection should always check whether it compiles with no optional
errors enabled.

If the generated code does not compile because of the errors enabled, it should
fail the build.

Because the optional errors are about likely error indicators, and
introspection is about type checking / missing methods / etc.

It is fine, I believe, to fail a compilation due to optional errors, after
including code that works without missing errors and was checked by
__traits(compiles, ...).

--


More information about the Digitalmars-d-bugs mailing list