> Please note the biggest problem of inheritance-based interfaces: you cannot 
> add one to a type already in existence when you define the interface

Certainly you cannot; that is the point - not interfaces state, what types 
satisfy (implement) them, but the other way round, types state, what they 
implement, and interfaces can only restrict, what types can state that (say, 
providing signatures for required procs); not satisfying the interface's 
restrictions results not in rejecting for the type to be considered as being of 
that interface, but in a compile-time error. E.g., supposing concepts-syntax 
for interfaces:
    
    
    type
      I = interface x
            p(x)
      T = distinct int implements I
    # p(t: T) = discard
    

This should result in a compile-time error, unless the last line is uncommented.

And at the same time
    
    
    type
      I = interface x
            p(x)
      T = distinct int
    proc p(t: T) = discard
    echo T is I  # -> false
    

, because `T` here is not intended to be `I`.

Reply via email to