-
Notifications
You must be signed in to change notification settings - Fork 392
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
RFC for shared self types #863
Conversation
type t<As> = U | ||
``` | ||
|
||
which defines, when `t` has type `T`: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to be precise, you mean if there is already a local named t
in the scope that has unsealed type T
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it needs to be unsealed (though it's not much use if it's sealed).
If the user decides to add an explicit type annotation |
Co-authored-by: vegorov-rbx <75688451+vegorov-rbx@users.noreply.github.com>
This PR is closed as part of RFC migration; please see #1074 (comment) for context. Additional notes: This represents a significant user need, so this feels like something we need to finish specifying and implement. |
An RFC about the treatment of self parameters in methods declared with
function t:m()
. Currently every method gets a separate type forself
, but with this proposal they'd get the same type. This produces better type errors, and can drastically reduce the memory footprint of types.Rendered: https://github.com/asajeffrey/luau/blob/rfc-shared-self-types/rfcs/shared-self-types.md