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

RFC: Result type function #72

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Conversation

gaymeowing
Copy link
Contributor


## Design

The functionality of the `result` type function is special, with it being an exception as it'll create a type-pack union. Thus using the result type function will not require the developer to write an overloaded function type.
Copy link
Contributor

Choose a reason for hiding this comment

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

Type pack unions do not exist in Luau. So, there's no way for a type pack function to produce a type pack union.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, but result would be special cased. As its the only use for typepack unions.

Copy link
Contributor

Choose a reason for hiding this comment

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

There's not a way for us to do that right now. Type functions and type pack functions have to return types or type packs, and type packs are not unions. Doesn't mean we can't do this at all, but it does mean that this is essentially the same amount of work as proposing general support for type pack unions.

* Include `-` in all spellings of type-pack
* Make reason for preferring not having type-pack union syntax more explicit.
@aatxe aatxe self-assigned this Dec 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants