Grammar Fixes

* Include `-` in all spellings of type-pack
* Make reason for preferring not having type-pack union syntax more explicit.
This commit is contained in:
witchiest 2024-11-22 13:25:01 -05:00 committed by GitHub
parent 97f738eaf0
commit e7054b87dc
Signed by: DevComp
GPG key ID: B5690EEEBB952194

View file

@ -103,7 +103,7 @@ local success, result = pcall(mrow, "cat food", ":3")
## Alternatives ## Alternatives
Allow for type pack unions to be written by developers, with the syntax probably looking like this: Allow for type-pack unions to be written by developers, with the syntax probably looking like this:
```luau ```luau
local function mrow(meow: string, mrrp: string): (true, string) | (false, nil) local function mrow(meow: string, mrrp: string): (true, string) | (false, nil)
-- code here -- code here
@ -114,6 +114,6 @@ With this example breaking backwards compadibility with some types developers ma
-- inferred as: ((meow: string, mrrp: string) -> (true, string)) | false -- inferred as: ((meow: string, mrrp: string) -> (true, string)) | false
type mrrp = (meow: string, mrrp: string) -> (true, string) | false type mrrp = (meow: string, mrrp: string) -> (true, string) | false
``` ```
Although it should be mentioned that result types are the only valid usecase for type pack unions, and just having a result type would remove a potential footgun of someone using type pack unions for something thats not a result type. Although it should be mentioned that result types are the only valid usecase for type-pack unions, and just having a result type instead of general type-pack union syntax would remove a potential footgun. Of someone using type pack unions for something thats not a result type.
Do nothing, and leave it up to developers if they want to write overloaded functions, or make their own result type. Do nothing, and leave it up to developers if they want to write overloaded functions, or make their own result type.