Feature request: Path append operators for strings
Wyatt
wyatt.epp at gmail.com
Wed Jul 3 05:24:32 PDT 2013
On Tuesday, 2 July 2013 at 22:28:24 UTC, TommiT wrote:
> On Tuesday, 2 July 2013 at 21:48:54 UTC, Walter Bright wrote:
>> On 7/2/2013 1:47 PM, TommiT wrote:
>>> Division operator for strings doesn't make any sense,
>>
>> That's why overloading / to do something completely unrelated
>> to division is anti-ethical to writing understandable code.
>> The classic example of this is the overloading of << and >>
>> for stream operations in C++.
>
> I've never thought of it like that. At some point I remember
> writing a vector type which overloaded its binary * operator to
> mean dot product (or cross product, I can't remember). So, you
> can overload an operator, but you can't overload the meaning of
> an operator.
This is something I was discussing with a friend recently, and we
agreed it would be cool if there were set of operators with no
definition until overloaded, so you could use e.g. (.) for dot
product, (*) for cross product, (+) (or maybe [+]?) for matrix
add, etc. instead of overloading things that already have
specific, well-understood meaning.
-Wyatt
More information about the Digitalmars-d
mailing list