Proposal: Database Engine for D

rsw0x via Digitalmars-d digitalmars-d at puremagic.com
Thu Jan 7 17:39:46 PST 2016


On Monday, 4 January 2016 at 09:44:35 UTC, Walter Bright wrote:
> On 1/1/2016 3:33 AM, Russel Winder via Digitalmars-d wrote:
>> Or alternative 4, fix D so that proper operator definition can 
>> be
>> achieved.
>
> The way D's operator overloading is designed is not a mistake. 
> It's limitations are a feature, not a bug. It was deliberately 
> set up to:
>
> 1. Make doing C++ style iostreams hard.

struct _cout {

   auto opBinary(string s : "<<", T)(auto ref T rhs) {
     import std.stdio : write;

     write(rhs);
     return this;
   }
}

_cout cout;
void main() {
   cout << "Walter " << "hates " << "this." << endl;
}


and yet, I can't overload the address-of operator because Walter 
is afraid I might shoot my foot.


More information about the Digitalmars-d mailing list