On Sun, Feb 22, 2009 at 9:29 PM, bearophile <[email protected]> wrote:
> 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... Currently that's the case. But it's simply unspecified in the language specification, and there's no reason why the compiler can't turn: a = foo ~ "bar" ~ "baz"; into: a = foo ~ "barbaz"; FWIW the MiniD compiler does this already. It's just that DMD currently does concatenation constant folding in a simple manner that makes this kind of folding "invisible" to it. But when all the operands of the concatenations are strings - like when building up strings to be mixed-in, or in static/const variable initializers - then everything will obviously be folded at compile time.
