Skip to content

remove incorrect use of 'scope'#4556

Merged
DmitryOlshansky merged 1 commit intodlang:masterfrom
WalterBright:scopeparallel
Jul 5, 2016
Merged

remove incorrect use of 'scope'#4556
DmitryOlshansky merged 1 commit intodlang:masterfrom
WalterBright:scopeparallel

Conversation

@WalterBright
Copy link
Member

This is a blocker for dlang/dmd#5903

// Hack to take the address of a nested function w/o
// making a closure.
static auto scopedAddress(D)(scope D del)
static auto scopedAddress(D)(D del)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As per the comment above, this is common pattern that various projects use (e.g. vibe.d) to ensure that the clojure is not allocated with the GC. AFAIK, there's no other way to achieve this, because you can't (and it's not practical to) require callers to be @nogc, because in general they're not under your control.
This particular case could be worked around, but it still a breaking change for user code.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@WalterBright yah, can we add a cast to work around things?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The final version will be return scope. But the compiler isn't ready for that yet, so I put in this workaround for now.

@WalterBright
Copy link
Member Author

This is a blocking issue for progress on scope. Please don't delay pulling it.

@DmitryOlshansky
Copy link
Member

Auto-merge toggled on

@DmitryOlshansky DmitryOlshansky merged commit c8f75f7 into dlang:master Jul 5, 2016
@WalterBright
Copy link
Member Author

Thanks!

@WalterBright WalterBright deleted the scopeparallel branch July 5, 2016 01:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants