bearophile wrote:
Denis Koroskin:
bearophile:
void main() {
string foo = "foo";
string bar = foo ~ "bar" ~ "baz";
}
Won't work. Imaging foo is a user-defined type with custom opCat:
auto bar = foo ~ "123" ~ "456";
compare to:
std::cout << "123" << "456";
In this thread I was talking about the concat of true strings, not of generic
objects:
auto bar = foo ~ ("123" ~ "456");
Are you saying that the concat operation of
"123" ~ "456"
has a different (invisible) "operator" precedence of:
"123" "456" ?
If this is true, then the ~ isn't a fully drop-in replacement for the automatic
concat of strings as done in C...
Bye,
bearophile
"123" "456" has the higher precedence