DustMite: the General-Purpose Data Reduction Tool (from the D Blog)

Vladimir Panteleev thecybershadow.lists at gmail.com
Mon Apr 13 19:06:44 UTC 2020


On Monday, 13 April 2020 at 18:53:39 UTC, Steven Schveighoffer 
wrote:
> Very nice article!

Thank you!

> Interesting from the animation that it decided that importing 
> std.stdio can be "reduced" to importing std!

Yes, it's a new minor annoyance for all DustMite users :)

> I see that you can prevent reductions via regex.

Regex and similar rules are applied at input parsing time, not on 
the emitted output.

> How do you say "Don't reduce `std\..*` to `std`" or is that 
> possible? In other words, I'm fine with reducing imports, but 
> not that specific reduction.

The canonical way, right now, is to add something like `if grep 
-q 'import .*std[;,]' ; then exit 1 ; fi` to the test script. To 
make this test reusable, it can be saved to e.g. 
"dustmite-no-std" and DustMite invoked with `dustmite src 
"dustmite-no-std && ../actual-test-script.sh"`.

I don't know if it's worth it, but to make this common annoyance 
easier to handle without baking in more highly-D-specific stuff 
into a tool which aims to be general-purpose, I'm thinking of the 
following additions:

1. Allow more than one test command. A reduction is considered 
successful only if all test commands pass. (It would be the 
equivalent of chaining them with && in a shell command.)
2. Add built-in tests which can be used in place of a test 
command, such as ":d-no-std".



More information about the Digitalmars-d-announce mailing list