Building C++ modules
Walter Bright
newshound2 at digitalmars.com
Wed Aug 14 19:59:30 UTC 2019
On 8/14/2019 12:08 PM, H. S. Teoh wrote:
> It also goes to strengthen the argument that operator overloading should
> not be abused the way it has been in C++. Choosing << and >> for I/O
> seemed like a clever thing to do at the time, but it led to all sorts of
> silliness like unexpected precedence and ambiguity with actual
> arithmetic shift operations, necessitating the proliferation of
> parentheses around I/O chains (which, arguably, defeats the aesthetics
> of "<<" and ">>" in the first place).
Worse, you cannot do anything that requires persistent state, because for `A<<B`
if A sets a state, an exception can be thrown before B is executed, and now the
iostream state is hosed. It isn't thread-safe, either.
> And don't even mention that Boost
> monstrosity that uses operator overloading for compile-time regexen.
> Ick. The very thought makes me cringe.
That was one of the examples that convinced me to make it hard to do such things
with D.
More information about the Digitalmars-d
mailing list