rafaqz / Interfaces.jl

Macros to define and implement interfaces, to ensure they are checked and correct.
MIT License
72 stars 4 forks source link

Interface testing at compile time or runtime? #24

Open gdalle opened 9 months ago

gdalle commented 9 months ago

This is the central question that many other issues are debating. At the moment, for performance reasons, testing is optional and can be done in the implementer package's test suite with Interfaces.test

Pull requests:

Issues:

rafaqz commented 9 months ago

I think what was overlooked is that we can just accomodate both.

If you pass :untested or maybe :unproven to @implements then we wont run tests in precompile, and you have to run Interfaces.test manually.

Then we can define istested for a compile time check if packages want a strong guarantee of the interface.

On top of no precompile testing packages can also opt out of providing test objects to @implements, and they will need to provide them manually in test.

gdalle commented 9 months ago

That sounds good but we also need to keep in mind that each of these induces additional complexity in terms of both code and user experience

rafaqz commented 9 months ago

Totally. Although we have half the code complexity already (because it was never deleted). I think this will only be about 10-20 lines added.

For the user experience I think the unproven option would not be widely advertised to minimise confusion, but available to those that look for it.