dmd 2.029 release

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Thu Apr 23 07:28:53 PDT 2009


Denis Koroskin wrote:
> Sink is okay, but most my usages belong to one of the two scenarios: 
> 1) I need a string representation of an Object - how is Sink useful
> here? I just want to call obj.toString() and get the result 2) I need
> to print it to stdout, thus I call writeln/Stdout(obj); - Sink is of
> no use here again.

I hear you, but there are quite a few more considerations that apply.

For one, making string the common format of all objects is pretty 
hamfisted. We need to integrate things like binary streams too. Second, 
using string append and composing with it is bound to be inefficient, 
and for multiple reasons. You can't just say that a reasonable way to 
print a matrix is to call toString against it and print the resulting 
string. With the temporary buffer passed-in or not, that's just a 
terrible design.

But you need not fear. Converting to string will remain easy and simple, 
  it will only be a particular case of streaming objects out.


Andrei


More information about the Digitalmars-d-announce mailing list