On 10/31/14 2:11 PM, H. S. Teoh via Digitalmars-d wrote:
On Fri, Oct 31, 2014 at 02:01:50PM -0700, Walter Bright via Digitalmars-d wrote:
On 10/31/2014 12:07 PM, H. S. Teoh via Digitalmars-d wrote:
On Fri, Oct 31, 2014 at 12:04:24PM -0700, Walter Bright via Digitalmars-d wrote:
On 10/27/2014 12:42 AM, Benjamin Thaut wrote:
I'm planning on doing a pull request for druntime which rewrites
every toString function within druntime to use the new sink
signature. That way druntime would cause a lot less allocations
which end up beeing garbage right away. Are there any objections
against doing so? Any reasons why such a pull request would not get
accepted?

Why a sink version instead of an Output Range?

To allow toString to be a virtual function, perhaps?

Output ranges can be virtual functions. All an output range is is a
type with a "put" method.

The problem is that you don't know the type of the output range in
advance. So you'd have to templatize toString. Which means it can no
longer be virtual.

Yah, for such stuff a delegate that takes a const(char)[] comes to mind. -- Andrei

Reply via email to