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

@lifetime annotation + simplified implicit lifetime dependencies #9

Merged
merged 3 commits into from
Aug 13, 2024

Conversation

atrick
Copy link

@atrick atrick commented Aug 1, 2024

New alternative considered: @Lifetime annotation
Simplified implicit lifetime dependencies

This section was a distraction. Changing the position of `dependsOn`
for initializers is not something we need to consider initially.
- is non-BitwiseCopyable and has an explicit `borrowing`, or `inout` convention

In this case, the compiler will infer a dependency on the unique argument identified by these conditions.
**For methods where the return value is nonescapable and self is not the same type as the result**, we will infer a dependency against self, depending on the mutation type of the function. Note that this is not affected by the presence, type, or modifier of any other arguments to the method.
Copy link
Owner

Choose a reason for hiding this comment

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

What if self is the same type as the result? I'm not sure I understand why you're excepting that case.

I suggest adding a sentence in here somewhere to clarify that these rules can result in multiple lifetime dependencies. In particular, for a method T.foo(:U, :U) -> U, the result will depend on self and both arguments.

@tbkka tbkka merged commit 4152b2e into tbkka:tbkka-lifetime-dependency Aug 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants