Warn on unused imports?

Dominikus Dittes Scherkl dominikus.scherkl at continental-corporation.com
Wed Sep 26 09:12:57 UTC 2018


On Tuesday, 25 September 2018 at 14:28:48 UTC, FeepingCreature 
wrote:
> On Tuesday, 25 September 2018 at 14:15:32 UTC, Dominikus Dittes 
> Scherkl wrote:
>> template from(string moduleName)
>> {
>>   mixin("import from = " ~ moduleName ~ ";");
>> }
>
> class TestException(T) : from!"std.format".FormatException?
>
> That should work, but it's kind of a big step. In any case, 
> I'll never get a weird hacky template like that through code 
> review :)
That "weird" template is about to be added to phobos.
Since its invention one and a half year ago I use it pretty much 
everywhere in my code for parameters that otherwise would require 
a global import. I just wasn't sure if it would work in this 
place too (that usecase never arose to me).
I don't understand, why a standard template wouldn't pass a 
review.


More information about the Digitalmars-d mailing list