This looks to be more a limitation in the current concept implementation 
(although whether the limitation will be lifted is a design decision that Araq 
will have to make).

Currently the compiler only considers globally-scoped procedures when testing 
of a concept "fits" a type, likely for complexity reasons.

For example, what would happen in your code if a global 'cost' procedure is 
already declared? What happens if you try to pass `g` in `print_route1` to 
another procedure expecting a `Graph` argument (`g` may be considered a Graph 
in the scope of `print_route1`, but not in the scope of sub-procedure calls).

Again, this appears to be more of a limitation of the current concepts 
implementation than a limitation in the abstract idea of concepts.

As a workaround, you can either just use plain generics (I think), templates, 
or as a final resort, procedure parameters or procedure tables/structs (like 
C++ vtables).

Reply via email to