For a simpler example of a nongeneric type that maps to a generic concept, one
may want strings to be collections of chars
type Container[T] = concept x
var n: int
x[n] is T
assert string is Container[char]
If I understand the proposal of Araq correctly, one would need to do something
like
type StringAsContainer[T] = string
var x: StringAsContainer[char]
Then the compiler, when matching `x` to check that it is a `Container[char]`,
would notice that `x` has a generic type.
I have two issues with this:
* it is a cumbersome pattern, that must be repeated every time a string has
to be used as a collection of chars
* it is opt-in, unlike concepts that are applied automatically whenever some
functions are defined
If we are going to make this opt-in, why not go all the way and require that
(at least generic) concepts are always opt-in?
One could just add a line such as
string is Container[char]
If the line compiles, it also informs the compiler that when disambiguating
types in generic concepts we want the generic parameter of `string` to be
`char`. For the standard container case, one could just say
seq[T] is Container[T]
If one is willing to introduce new syntax, such as
declare seq[T] is Container[T]
declare* seq[T] is Container[T]
one could also make such assertions exportable