On Friday, 29 December 2017 at 12:59:21 UTC, rjframe wrote:
On Fri, 29 Dec 2017 12:39:25 +0000, Nicholas Wilson wrote:
On Friday, 29 December 2017 at 12:03:59 UTC, Mike Franklin
wrote:
The problem is that interfaces are a runtime thing (e.g. you
can cast a
class to an interface)
structs implement compile time interfaces via template duck
typing
(usually enforced via an if()).
you could probably write a wrapper that introspected an
interface and
enforced that all members were implemented.
I've actually thought about doing this to get rid of a bunch of
if qualifiers in my function declarations. `static interface
{}` compiles but doesn't [currently] seem to mean anything to
the compiler, but could be a hint to the programmer that
nothing will directly implement it; it's a compile-time
interface. This would provide a more generic way of doing stuff
like `isInputRange`, etc.
Atila does something like this
https://code.dlang.org/packages/concepts