__traits(compileError, {})

Jonathan M Davis via Digitalmars-d digitalmars-d at puremagic.com
Sun Sep 10 17:15:08 PDT 2017

On Sunday, September 10, 2017 23:25:59 bitwise via Digitalmars-d wrote:
> On Friday, 8 September 2017 at 01:18:46 UTC, bitwise wrote:
> > Lately, I've been hit by several compilation errors when phobos
> > fails to construct an instance of a class or struct I've pass
> > it. Regardless of what the exact failure is, phobos usually
> > gives you some generic error that isn't helpful.
> >
> > [...]
> Does anyone even follow procedures of any kind for additions this
> trivial, or do they just do pull requests and debate it there?

Additions to the standard library on the size of new modules or redesigned
modules require a formal review in the main newsgroup, but making changes to
individual functions don't. If you're looking to add something to the
compiler, it could simply be a PR, or it could require a DIP, depending on
its scope and what Walter and the other compiler devs think.

In the case of your suggestion, I'd argue that it would simply be better to
improve the compiler-generated error messages if they're not good enough
rather than trying to add some mechanism to inject messages from the
programmer into the compiler's error messages. And remember that you do
already have static assert, pragma(msg, ...), and __traits(compiles, ...) to
work with if you want to be adding additional compile-time checks and/or
printing out additional messages at compile time.  But if you have an idea
that you want to implement and try and get in, then implement it and create
a PR. Worst case, they tell you that it's not a desirable change or that a
more formal review is necessary. And in the latter case, that just means
that you then know what you need to do to go to the next step.

- Jonathan M Davis

More information about the Digitalmars-d mailing list