best replacement for - cout << "hello D" << endl; ?
Bill Baxter
dnewsgroup at billbaxter.com
Wed Jul 11 01:05:55 PDT 2007
Bruce Adams wrote:
>> import tango.io.Stdout;
>>
>> void main()
>> {
>> int x = 6;
>> Stdout("X is: ")(x).newline;
>> }
>>
>> Like in C++ streams, each item is outputted separately, and uses its own
>> method overload, avoiding runtime type identification. Objects which read
>> use the same syntax (called "whisper" for reasons I don't entirely
>> understand ;) ).
>>
> That is so ugly. I haven't found a page on operator overloading yet but there must be better choices availabe. Even ++ as a binary operator would be better.
>
Some folks actually really dig it. I can't say I'm a huge fan, but I'll
admit it looks better to me << than << "lots" << of << "<<" <<
everywhere << endl.
About enforcing type safety at compile time, I don't think doFormat does
any compile time checking. As far as I know, the only compile time
formatters are experimental things, based on the growing CFTE string
parsing functionality in D.
--bb
More information about the Digitalmars-d-learn
mailing list