Bug 18153 – deprecate public symbols ByLine, ByRecord, ByChunk
Status
RESOLVED
Resolution
FIXED
Severity
minor
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2018-01-02T23:06:30Z
Last change time
2018-01-03T00:53:52Z
Keywords
pull
Assigned to
Seb
Creator
Dennis
Comments
Comment #0 by dkorpel — 2018-01-02T23:06:30Z
I accidentily wrote this code:
import std.stdio;
foreach(line; File(fileName, "r").ByLine) {
...
}
And got this confusing error:
Error: cannot resolve type for ((File __slFile908 = File(null, null);) , __slFile908).this(fileName, "r").ByLine(Char, Terminator)
It turns out I wasn't calling the method 'byLine' but the constructor of the struct 'ByLine'. Is there any reason the struct ByLine, as well as ByChunk and ByRecord, are public? I can't find any documentation on them. I suggest either making them private (like ByLineCopy), or documenting their use.
Comment #1 by greensunny12 — 2018-01-02T23:22:26Z
Have a look here: https://github.com/dlang/phobos/blob/master/std/stdio.d#L2070
A long time ago ByLine and friends used to be publicly documented. However, it was realized that this is a mistake and thus only undocumented.
> suggest either making them private (like ByLineCopy)
Yes, that's the way to move forward. It can be done with sth. like this:
```
deprecated("Use .byLine")
alias ByLine = ByLineImpl;
```