Bug 6641 – RefAppender!(T[]) should be OutputRange.
Status
RESOLVED
Resolution
WORKSFORME
Severity
normal
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2011-09-10T07:07:34Z
Last change time
2019-12-09T12:26:06Z
Keywords
bootcamp
Assigned to
No Owner
Creator
SHOO
Comments
Comment #0 by zan77137 — 2011-09-10T07:07:34Z
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 by dsimcha — 2011-09-10T07:16:37Z
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 by zan77137 — 2011-09-10T08:41:34Z
(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.