D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 6641 - RefAppender!(T[]) should be OutputRange.
Summary: RefAppender!(T[]) should be OutputRange.
Status: RESOLVED WORKSFORME
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D2
Hardware: All All
: P2 normal
Assignee: No Owner
URL:
Keywords: bootcamp
Depends on:
Blocks:
 
Reported: 2011-09-10 07:07 UTC by SHOO
Modified: 2019-12-09 12:26 UTC (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description SHOO 2011-09-10 07:07:34 UTC
This code doesn't work!

--------------------------
import std.array, std.range;

static assert(isOutputRange!(Appender!(ubyte[]), ubyte));
static assert(isOutputRange!(RefAppender!(ubyte[]), ubyte));

void main() {}
--------------------------
$ dmd -run main
main.d(4): Error: static assert  (isOutputRange!(RefAppender!(ubyte[]),ubyte)) i
s false
Comment 1 David Simcha 2011-09-10 07:16:37 UTC
I think RefAppender should just be deprecated/scheduled for deprecation.  It was a short term backwards compatibility hack from a long time ago.
Comment 2 SHOO 2011-09-10 08:41:34 UTC
(In reply to comment #1)
> I think RefAppender should just be deprecated/scheduled for deprecation.  It
> was a short term backwards compatibility hack from a long time ago.

Hmm...

I understand it as follows:
- It is the class which it is easy to be used in the wrong way. (User must not add elements to the array while appending with RefAppender)
- The improper usage is easier to become the factor of the bug.
- Therefore it is deprecated.
Is this right?

And, I think that it is necessary to satisfy at least one of the following conditions to make RefAppender deprecated:
- Appender does not allow the similar improper usage.
- Appender is as fast as the RefAppender.
- Appender's memory efficiency is as well as RefAppender's.