Just one quick comment. Quoting the OP

> Well, then it is useless. I am from a domain (science) where similar concepts 
> are generally called a similar way and where clashes occur a lot because 
> something as simple as * has a gazillion meanings depending on the context 
> (and all of them applied to arrays of any dimensions, so no useful dispatch 
> there).

If I understand correctly, the whole thing is needed because the current 
overloading is not sufficient - the same `*` operation might mean different 
things in different contexts, and the types do not change.

Now, mathematicians are well accustomed to the idea that the same underlying 
set can have, say, different group operations. The result is considered a 
different group, even though the elements are the same.

In this context, I think the simplest thing would be to use a distinct type. 
For instance, `seq[float]` might support `+` in two different ways: summing by 
coordinate or concatenating the sequence.

If one wants to introduce `+` as an operation to concatenate seqs, all that 
needs to be done is
    
    
    type JoinableSeq = distinct seq[float]
    
    proc `+`(r, s: JoinableSeq): JoinableSeq = ...
    

In this way, this would not conflict with the operation `+` that maybe another 
part defines to sum by coordinate.

This has a few advantages:

  * no need to change the core language
  * no need to learn more complex import rules
  * types are used not only to define the set of values, but also the 
associated operations, much like mathematicians have been doing for centuries


Reply via email to