This repository was archived by the owner on Oct 12, 2022. It is now read-only.
Make assumeSafeAppend nothrow. #632
Closed
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.
Try two. This time, I was able to mark and certify it as pure.
First: I spliced
__setArrayAllocLength
into two different functions:The advantages are twofold:
nothrow
.Second: I "aligned" the forward declarations of
gc_*
inrt/lifetime.d
with those incore.memory.d
: They now declare more or less exactly the same thing, and have the same qualifiers: mostlypure
, and mostlynothrow
. I'd like to mention that apparently, none of these functions are actually nothrow, since the GC will lock, but apparently, we can assume the GC never throws anyways?FInally: With the above two conditions, I was able to vertifiably mark
_d_arrayshrinkfit
asnothrow
, which meansassumeSafeAppend
can also be marked as such. I also marked it aspure
: Even though I was not able to mark_d_arrayshrinkfit
as such (because of a static variable for GC initialization), functionally, it's pure (That, also, is what the GC does).