[trivial] Either make private or document undocumented public symbols in stdio#4789
[trivial] Either make private or document undocumented public symbols in stdio#4789andralex merged 1 commit intodlang:masterfrom
Conversation
|
What the reason of that change? This will break existing code |
std/stdio.d
Outdated
| be compatible with the access attributes of the handle. Windows only. | ||
|
|
||
| Throws: $(D ErrnoException) in case of error. | ||
| Throws: $(D ErrgnoException) in case of error. |
There was a problem hiding this comment.
Somehow, I don't think that you meant to insert a g here.
std/stdio.d
Outdated
| } | ||
| // no UTF checking | ||
| /// Implements `opApply` `foreach` support but with no UTF checking | ||
| int opApplyRaw(D)(scope D dg) |
There was a problem hiding this comment.
This looks like it's just intended to be used by opApply and should not be treated as public.
There was a problem hiding this comment.
ok, will mark as private
If something isn't documented, then it doesn't exist. Anyone who uses an undocumented symbol has no guarantees that their code won't be broken by changes to it later. |
I don't agree. No guarantees, but it still exists. And an engineer do not need to spend time by copypasting code |
|
These symbols were completely undocumented. The only way people were using these is if they found them by pure chance or they were looking at Phobos code. Either way, they aren't officially part of the Phobos API, so this is not a breaking change |
Current coverage is 88.86% (diff: 100%)
|
a6a6b82 to
aa94232
Compare
|
FIxed |
|
The only real way to understand phobos is to look into its code. Our documentation is not so good |
It's as good or better than most of the documentation for C++'s standard library, and you don't go looking though the STL and decide to use undocumented symbols do you? |
I don't. STL has much more users and online activity. STL and Boost sources looks terrible for me. Phobos sources are readable and clean. |
So, because there are fewer people to ask questions about Phobos, and it's actually readable, you think that folks should be able to expect to rely on undocumented symbols? I really don't think that that's reasonable. If they were intended to be part of the public API, they would be documented. The fact that they're public is either a mistake or a workaround for a problem and not because it's something that anyone should be using. |
|
@JackStouffer It looks like you have some trailing whitespace, and the auto-tester doesn't like that. |
aa94232 to
8ef278d
Compare
|
I think that code was written by @andralex I think he should comment on whether they are meant to be public or not. |
|
@JackStouffer Please in the future use more descriptive branch names than things like This could be called |
|
There are two kinds of undocumented public symbols: (a) some that were inadvertent, (b) some that used to be documented and have been shunned by being left out there but undocumented in order to not break code. I encourage making those in category (a) private, but (b)s should be left alone (at best with a comment indicating they're to stay put. @JackStouffer could you do some detective work on the file history to see which is which? Thx! |
|
Here's my philosophy:
I believe these changes fall in line with that. The structs were never meant to be used directly; you're supposed to use the factory functions. |
|
I expect category (b) to have a (non-ddoc) comment stating that the symbols are there for legacy reasons. |
|
Auto-merge toggled on |
|
breakage confirmed since 2.072. DFMT uses a few of these symbols. See https://github.com/Hackerpilot/dfmt/blob/master/src/dfmt/main.d#L118 |
|
I suggest that these should be deprecated BEFORE private. |
|
@qchikara that is indeed a correct (and required) approach. |
No description provided.