Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

document ref-return-scope function parameters #2584

Merged
merged 1 commit into from
Feb 19, 2019

Conversation

WalterBright
Copy link
Member

Part of DIP1000.

@WalterBright WalterBright added the Vision https://wiki.dlang.org/Vision/2018H1 label Feb 19, 2019
@dlang-bot
Copy link
Contributor

Thanks for your pull request, @WalterBright!

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.


---
U xerxes(ref return scope V v); // (1) ref and return scope
ref U xerxes(ref return scope V v); // (2) return ref and scope
Copy link
Contributor

Choose a reason for hiding this comment

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

This is still a bit cryptic to me, could you add some (il)legal uses/definitions please?

Copy link
Member Author

Choose a reason for hiding this comment

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

done

int foo2(return scope ref S s);

ref int* foo3(return ref scope S s);
ref int foo4(return ref scope S s);
Copy link
Contributor

Choose a reason for hiding this comment

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

Please avoid aligning the code. It will just require more work if new examples are added.

Copy link
Member

Choose a reason for hiding this comment

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

I disagree, in this particular case it really helps to get the point across.

@WalterBright WalterBright merged commit d7f8b41 into dlang:master Feb 19, 2019
@WalterBright WalterBright deleted the ref-return-scope branch February 19, 2019 22:52

$(P The second form attaches the `return` to the `ref`, and has
$(LINK2 #return-ref-parameters, return ref parameter) semantics
with additional
Copy link
Member

Choose a reason for hiding this comment

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

Don't use relative LINK2 in the specification. It doesn't work with Latex.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Spec / content Vision https://wiki.dlang.org/Vision/2018H1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants