I'm looking at an issue that proposes using concepts to enforce a simple 
interface - 
[https://github.com/status-im/nim-eth-common/issues/8](https://github.com/status-im/nim-eth-common/issues/8)
 \- and find myself thinking that the syntax is very odd; an interface is 
declared up-front to be implemented by whatever type you pass to the concept 
checker, but this is not the way the concept is written - instead, there's a 
list of expressions that are expected to work for the type to pass, meaning 
that:

  * to implement your type, you have to work "backwards" from the concept, 
executing it in your head and figuring out what the the proc's should look like 
to make sure the concept executes correctly - this makes it hard to work it out 
at a glance (specially looking at some of the more exotic examples in the docs 
- with for loops and all) what proc's you need to write - practical meaning: 
can't copy-paste to implement
  * interfaces are declarative compile time constructs, yet concepts read more 
like procedural code - is there any alternate syntax that captures the 
declarative nature of an interface?
  * could/would you do a macro to provide such a syntax?
  * interfaces can typically be used compile-time or runtime (ie rust traits, 
c++ virtual methods/devirtualization, etc), depending on the types known to the 
compiler at the instantiation point - what about concepts? what would the steps 
be to implement an array of heterogenous types, all conforming ot a concept?


Reply via email to