On Thu, 20 Sep 2012 17:06:19 +0200 "David Nadlinger" <[email protected]> wrote: > > The code on slide 6 contains an issue resp. inaccuracy: Not all > random access ranges are sliceable. Sometimes I wonder (and this > is not at all intended as a snide remark!) if it is too easy to > make mistakes regarding template constraints, if even you as the > (co-?) designer of std.range get them wrong occasionally. >
Maybe we could have an interface tester: Something that will automatically try to pass in a bunch of known types to whatever templated function you give it (and maybe a limited subset of combinations for multiple args), and makes sure the the result is always either "Compiles OK" or "Match not found", and never a compile error from *inside* the given function template. When it compiles OK, maybe it could even automatically run associated unittests (not sure though). I don't know that this could be done as a library, as it would require distinguishing between different types of compile errors. But I bet it could reasonably be done as a CLI tool that invokes DMD.
