mirror of
https://github.com/luau-lang/rfcs.git
synced 2025-05-04 10:43:48 +01:00
Add discussion for handling @checked
This commit is contained in:
parent
040774b65e
commit
084bd4f9b3
1 changed files with 7 additions and 0 deletions
|
@ -32,6 +32,13 @@ Since an opening parenthesis starts a parameter list for the attribute, the expr
|
||||||
(f().x)
|
(f().x)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
We currently have an ad-hoc implementation of `@checked` attribute, used in declaration files. It is specified in two ways:
|
||||||
|
|
||||||
|
1. `declare function @checked abs(n: number): number`
|
||||||
|
2. `writef64: @checked (b: buffer, offset: number, value: number) -> ()`
|
||||||
|
|
||||||
|
For uniformity, declarations using the first style will be modified to use `@checked` attribute before the `function` keyword and declarations using the second style will be modified to use `@checked()` to ensure that the function parameter list is not treated as an attribute parameter list.
|
||||||
|
|
||||||
There are two notable exclusions in this syntax.
|
There are two notable exclusions in this syntax.
|
||||||
|
|
||||||
1. Literal `table` values are excluded from being passed as parameters since they are composite structures; information supplied via table fields can be passed as separate parameters to the attribute. If they are still deemed useful, a follow-up RFC can introduce them with motivating use cases.
|
1. Literal `table` values are excluded from being passed as parameters since they are composite structures; information supplied via table fields can be passed as separate parameters to the attribute. If they are still deemed useful, a follow-up RFC can introduce them with motivating use cases.
|
||||||
|
|
Loading…
Add table
Reference in a new issue