Skip to content

Conversation

@wilzbach
Copy link
Contributor

Alternative version to: #6332

Still not perfect and I don't know why this is disallowed:

auto rbt4 = redBlackTree(chain(["hello"], ["world"]));
assert(equal(rbt4[], ["hello", "world"]));

but this is allowed:

auto rbt5 = redBlackTree!true(chain([0, 1], [5, 7, 5]));
assert(equal(rbt5[], [0, 1, 5, 5, 7]));

@dlang-bot
Copy link
Contributor

Thanks for your pull request, @wilzbach!

Bugzilla references

Your PR doesn't reference any Bugzilla issue.

If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog.

Testing this PR locally

If you don't have a local development environment setup, you can use Digger to test this PR:

dub fetch digger
dub run digger -- build "master + phobos#6362"

@wilzbach wilzbach requested a review from PetarKirov as a code owner March 28, 2018 07:08
@wilzbach wilzbach force-pushed the rbtree-dip1000 branch 2 times, most recently from b2a989d to 8b8b484 Compare March 28, 2018 07:15
@WalterBright WalterBright added the Review:Vision Vision Plan https://wiki.dlang.org/Vision/2018H1 label Mar 28, 2018
@schveiguy
Copy link
Member

is scope transitive? If so, then it's going to be impossible to work with this.

For example, the ctor that accepts a stack-allocated list of elems must be declared scope (the array is on the stack after all), but the elements themselves may not be if they point at non-scope data (such as strings).

@WalterBright
Copy link
Member

scope is not transitive

@wilzbach
Copy link
Contributor Author

@WalterBright you need to approve PRs at druntime & Phobos before/when adding auto-merge.

@schveiguy
Copy link
Member

schveiguy commented Mar 30, 2018

scope is not transitive

It sure seems like it is. If I mark a parameter scope, then all the references inside that parameter appear to be assumed scope:

@safe:
void noscope(string s) {}

void test(scope string[] arr) {
   noscope(s[0]); // Error: scope variable arr assigned to non-scope parameter s calling testscope.noscope
}

How do we identify that the strings inside arr are not scope?

@wilzbach
Copy link
Contributor Author

Superseded by #6931

@wilzbach wilzbach closed this May 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Review:Vision Vision Plan https://wiki.dlang.org/Vision/2018H1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants