Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d6c471b
commit 4f28db6
Showing
5 changed files
with
294 additions
and
294 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Oops, something went wrong.
4f28db6
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.
??? Why isn't the stuff in std.parallelism pure?
4f28db6
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's referring to non-immutable members of a non-local variable.
4f28db6
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.
Why can't the std.datetime stuff be pure? None of it is accessing non-immutable, non-local variables.
4f28db6
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.
4f28db6
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.
Walter decided to »tighten purity checks« in dlang/dmd@84b4fd1 …
4f28db6
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.
As I understand it, weakly pure functions are supposed to be able to do that.
4f28db6
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.
Without that, how can much in the way of member functions be pure?
4f28db6
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.
@WalterBright
With the weak purity rules, functions should be able to do anything they like with any passed in parameters, including the implicit this parameter. Their only restriction is they they cannot directly access non-immutable global variables directly. They can even access globals if they are passed a pointer to them.
Purity isn't violated as strong-pure functions would never be able to pass global data into weak pure functions anyway.