Feature request: Path append operators for strings

Jonathan M Davis jmdavisProg at gmx.com
Fri Jul 5 12:26:34 PDT 2013


On Friday, July 05, 2013 16:59:38 TommiT wrote:
> On Tuesday, 2 July 2013 at 23:28:41 UTC, monarch_dodra 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.
> > 
> > s/division/"The common agreed upon semantic"/
> > 
> >> The classic example of this is the overloading of << and >>
> >> for stream operations in C++.
> > 
> > Or overloading ~ to mean "concat" ?
> 
> It's rather C++'s std::string which overloads the meaning of + to
> mean "concatenation". I wonder if some other programming language
> has assigned some other symbol (than ~) to mean "concatenation".
> I guess math uses || for it.

Most languages I've used use + for concatenating strings, so it was definitely 
surprising to me that D didn't. I have no problem with the fact that it has a 
specific operator for concatenation (and there are some good reasons for it), 
but + seems to be pretty standard across languages from what I've seen. I've 
certainly never seen another language use ~ for that purpose, but at the 
moment, I can't remember whether I've ever seen another programming language 
use ~ for _any_ purpose.

- Jonathan M Davis


More information about the Digitalmars-d mailing list