-
-
Notifications
You must be signed in to change notification settings - Fork 747
std.socket: Fix some -dip1000 compilable issues #6204
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You cannot change this class. It is part of a unit test, so by changing it, you are changing a test that has been put in place to guard against breaking user code. This class is here to test for inadvertently breaking user classes which derive from
Socket. Any changes here need to have a strong rationale for potentially breaking user code.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There seems to be a conflict of objectives:
To the best of my knowledge - with current DIP1000.md and it's implementation (scope is a part of (member) function's signature/mangling) - I don't see a way to have std.socket -dip1000 compilable without breaking user code (i.e. change class Socket). According to https://github.com/dlang/DIPs/blob/master/DIPs/DIP1000.md#breaking-changes--deprecation-process it's known there will be breaking changes; IMHO this PR is an example for coming breakages, but I now understand - supposed my PR is correct - it shouldn't be merged without a deprecation process in concert with -transition=safe.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CC @andralex @MartinNowak @WalterBright
What's the strategy for such errors resulting from DIP1000 upgrades?
Do we need to introduce some
@__futurelike behavior in the compiler to issue deprecations?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It simply means that Socket classes and sub-classes cannot be used as scoped classes with DIP1000, because it's unclear whether they escape sth. or not. It should remain fully useable with GC allocated Socket classes though.
As @CyberShadow said, if Socket is not final we cannot suddenly require all derivatives to obey to not escaping sth.
That's unfortunate but a big restriction with open interface&classes in APIs.
I asked for
@futureto become useful for such deprecations as well, but it made it to a mentioning in https://github.com/dlang/DIPs/blob/master/DIPs/DIP1007.md#user-content-proposal under 6..I don't think exempting Socket from DIP1000 is a big issue, the whole module is outdated (by todays D standards) and class based sockets are questionable. Here is a possible replacement https://github.com/MartinNowak/io (though I still need to get
return scopecorrect).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no two-tier memory safety.
D can't ever claim memory safety of @safe code, if it starts to exempt some phobos module(s) from memory checks which possibly may then escape pointers to expired stack frames or alike.
Walter said at DConf2017, he believes there is a tsunami coming and predicted, it will kill the C language. That's my opinion too ref. growing importance of memory safety for language selection.
And D still isn't ahead of the caravan. https://www.youtube.com/watch?v=Lo6Q2vB9AAg
Was there a survey, whether users put up with code breakage mitigated by a reasonable deprecation duration, when they get memory safety in return?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I take this as PR rejection and will close it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about simply making
std.socket@System so it will compile with -dip1000 and move on?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes!! It's as simple as that to avoid changing class socket and be -dip1000 compilable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's do it, then.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-> #6384