C++ UFCS update

Dominikus Dittes Scherkl via Digitalmars-d digitalmars-d at puremagic.com
Tue Feb 23 23:25:13 PST 2016


On Tuesday, 23 February 2016 at 20:35:16 UTC, Ola Fosheim Grøstad 
wrote:
> The primary issue I have with iostream is that floating point 
> formatting gets ugly. The "<<" works out ok for iostream in 
> practice, mostly because it is not common to do bit-shifts in 
> combination with IO.

stdout << "double value is: " << i<<1;

Oops.
This happens, and you won't notice until someone complains about 
the wrong value in the output.

in D neither ! nor ~ is "reused". They are both unary operators 
in C. D only defined new binary operators which use the same 
characters, but there is no way to confuse them.

On the other side having two different "piplining" operators "." 
and "->" makes refactoring the code an ugly mess: If you decided 
to use a reference parameter instead of a pointer you have to 
replace all "->" by ".". But oops, there is still a pointer 
within the referenced struct? So, don't replace them all, but 
carefully revisit them to check where "." is necessary and where 
"->".
I always hated that!


More information about the Digitalmars-d mailing list