eliminate writeln et comp?
Andrei Alexandrescu
SeeWebsiteForEmail at erdani.org
Tue Mar 17 18:42:08 PDT 2009
Denis Koroskin wrote:
> On Wed, 18 Mar 2009 03:26:16 +0300, Andrei Alexandrescu
> <SeeWebsiteForEmail at erdani.org> wrote:
>
>> Denis Koroskin wrote:
>>> That's not a very frequent operation. In most cases you should use
>>> Cout("Hello"); instead. An ideal design solution, imo (fast, short
>>> and clear).
>>
>> Interesting. Should I do the same in phobos?
>>
>> stdout("wyda");
>>
>> I'd like that particularly because write() is too common a name to
>> place at namespace level for my taste. So then we'd have:
>>
>> stdout("wyda"); // no newline
>> stdout("wyda\n"); // newline but no flushing on binary stream
>> stdout("wyda", newline); // write'n'flush
>> stdout.writeln("wyda"); // same
>>
>> If we go that route I'll even drop writeln and rely on passing
>> newline. For formatting there'd be stdout.format and stdout.formatln
>> or something.
>>
>
> This is funny because Tango has adopted exactly the same design.
Well it isn't funny. It's obvious: you just told me about it! :o)
> The only difference is that Stdout is written in upper case:
>
> import tango.io.Stdout;
>
> void main() {
> Stdout("Hello, World\n"); // no flushing
> Stdout("Hello, World").newline; // new line appended, flushs
> Stdout.format("Hello, {}!", "Andrei").newline; // formatting
> Stdout.formatln("Hello, {}!", "Kris");
> }
>
> It would be great if the two libraries share the same interface.
Ionno. In Phobos, types are Capitalized, values are camelCase or
justminuscules.
> BTW, since you are in process of redesigning of Phobos IO/stream system,
> it would be great if you take a look at the Tango IO system, first. I
> recall you telling that you didn't give a good look at Tango, so now is
> the time. I particularly insist on talking to Kris about it; perhaps, he
> has some ideas on the topic. He may also share experience with you
> (errors he made etc). I'll give you a few ideas of mine in a separate post.
I don't know about licensing issues, and last thing I need would be to
be accused of stealing from Tango.
> You shouldn't avoid looking on someone's code, especially if it may help
> D get better standard library. There's nothing wrong with borrowing
> ideas from others, too, especially if they give you a permission for
> that. Tango is dual-licensed under Academic Free License v3.0 and BSD
> License, so there might not be a need to, but anyway.
I have zero knowledge of licensing stuff, but I understand Walter does.
He's not looking at Tango so nor should I. I'm sure it has some cool
ideas, but so do other libraries.
Andrei
More information about the Digitalmars-d
mailing list