On 2/6/14, 9:19 AM, H. S. Teoh wrote:
On Thu, Feb 06, 2014 at 04:30:31PM +0000, Dicebot wrote:
On Thursday, 6 February 2014 at 16:25:37 UTC, Andrei Alexandrescu
wrote:
// lib code
struct RCSlice(T) { ... }
alias rcstring = RCSlice!(immutable char);
rcstring rc!(string s) { ... }

// user code
auto s1 = buildPath!("hello", "world");
auto s2 = buildPath!(rc!"hello", rc!"world");

In this example s1 will have type string and s2 will have type
rcstring.

Looks unnecessary restrictive. Why can't one build rc-string from
stack buffers or Array!char from rc-strings? Type of output buffer
does not have to do anything with input.

Agree. Phobos algorithms that populate a data sink should migrate toward
using output ranges instead of returning a predetermined type. This will
not only address ARC needs, but a bunch of other things as well (output
range support/use in Phobos is still rather scanty at the moment).

I will mention again that output ranges lead to quite a bit more code on the caller site. They do give great control, but I'm hoping for something more convenient.

Andrei

Reply via email to