Update syntax-named-function-type-returns.md

This commit is contained in:
Daniel P H Fox (Roblox) 2024-11-04 15:53:11 -08:00 committed by GitHub
parent 203d3af302
commit 8a92b3a126
Signed by: DevComp
GPG key ID: B5690EEEBB952194

View file

@ -69,7 +69,7 @@ local function x(): (return1: number, return2: number)
This syntax is fully backwards compatible as only type names, generic names, or type packs are allowed in return position.
Broadly, return names behave identically to parameter names.
Return names are documentative - they are not identifiers that are usable in the function body.
Function type comparisons will ignore the return names, this proposal doesn't change the semantics of the language and how typechecking is performed.
@ -194,4 +194,4 @@ For a community project to implement support, they would need to discover all of
There is a very real possibility that not implementing *any* standard way of annotating return type names will discourage people from documenting them at all, reducing the quality of documentation in the Luau ecosystem.
The upshot is that Luau would remain unopinionated and free to ignore comments completely. We punt the problem to the community and all consumers of Luau, who will have to invent their own methods of documenting this info if it is desired.
The upshot is that Luau would remain unopinionated and free to ignore comments completely. We punt the problem to the community and all consumers of Luau, who will have to invent their own methods of documenting this info if it is desired.