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.
This change is the polar opposite of #10213 but one that Andrew has expressed he would like. Instead of providing 2 ways to cleanup a file (one that invalidates and one that doesn't), this PR modifies
File.close
to always invalidate. Note this is a breaking change that now requires all instances ofFile
that you want to close to be mutable. This means no moreconst file =
, you must always usevar file =
. I've argued this reduces code readability, but that's my opinion, you can see for yourselves whether or not you agree and whether it would justify a second way to cleanup files (i.e. adding acloseConst
for const files).Also note that if we start requiring files to be mutable, we will be introducing "ownership" semantics to
File
. Namely, passing aFile
by value vs by reference has a new meaning, and having aFile
field as a value or a reference has new meaning. This adds complexity to howFile
is interpreted that doesn't exist today with immutable instances ofFile
.