On Saturday 12 February 2011 06:26:40 spir wrote: > On 02/12/2011 03:17 PM, bearophile wrote: > > Jonathan M Davis: > >> It's a problem of semantics. ~ is intended for eager concatenation. > >> That's how it's designed and what it's expected to mean. > > > > This is written nowhere. I am referring to my second proposal. It makes > > code more generic, because it allows you to use ~ for both arrays and > > lazy iterables in a polymorphic situation, and the computational > > complexity here is not a problem. I'd like to know Andrei opinion on > > this :-) > > > >> More importantly, that's how it > >> works for arrays. If you made it lower to chain, then either ~ for > >> arrays has become lazy (along with every other user-defined type which > >> overloads opBinary!"~" and made it eager as would be expected), > > > > I agree, that's why I have prosed a second alternative that lacks this > > problem (it doesn't use lowering, just operator overloading and a > > mixin). > > > >> Regardless, as it's not going to be implemented any time soon, there's > >> not much point in debating it right now. > > > > My second suggestion is related for Phobos only, and it's implementable > > now, if there's enough desire. > > HolĂ bearophile, > what about using '*' for chaining syntax sugar. I mean, func composition is > often written using '.' which means product (and is sometimes even spelled > "product" for functions too), right? And product is written '*' in D... > What do you think?
Walter already decided against using + for concatenation because of the perceived ambiguity - e.g. does "5" + "2" do "52" or "7"? He's not going to go for * for anything similar. Honestly, we don't need more syntactic sugar at this point. - Jonathan M Davis
