Should we add `a * b` for vectors?

H. S. Teoh hsteoh at quickfur.ath.cx
Sun Sep 24 22:33:48 UTC 2017


On Sun, Sep 24, 2017 at 06:18:38PM +0000, Mark via Digitalmars-d wrote:
> On Friday, 22 September 2017 at 17:11:56 UTC, Ilya Yaroshenko wrote:
> > Should we add `a * b` to ndslice for 1d vectors?
> > Discussion at https://github.com/libmir/mir-algorithm/issues/91
> 
> Generally I expect that a binary operation denoted by + or * would produce
> an element from the original domain, e.g. multiplying two matrices yields a
> matrix, concatenating two strings yields a string, etc. So personally I
> don't like this notation.
> 
> Note that in the case of 3-dimensional vectors, people might confuse this
> for the cross product. I would go with dot(a,b) and cross(a,b) (if you
> support it).

With UFCS, you have the slightly nicer notation a.dot(b) and a.cross(b).


T

-- 
Claiming that your operating system is the best in the world because more people use it is like saying McDonalds makes the best food in the world. -- Carl B. Constantine


More information about the Digitalmars-d mailing list