mirror of
https://github.com/luau-lang/luau.git
synced 2024-12-12 21:10:37 +00:00
Update typecheck.md
Wording changes in unknown symbols
This commit is contained in:
parent
9939c5c361
commit
2cd63aa589
1 changed files with 3 additions and 1 deletions
|
@ -29,7 +29,7 @@ However, in strict mode, the second snippet would be able to infer `number` for
|
|||
|
||||
## Unknown symbols
|
||||
|
||||
You may see this error a lot, and that's by design even in nonstrict mode.
|
||||
You may see this error when using custom globals, and that's by design even in nonstrict mode.
|
||||
|
||||
Consider how often you're likely to assign a new value to a local variable. What if you accidentally misspelled it? Oops, it's now assigned globally and your local variable is still using the old value.
|
||||
|
||||
|
@ -41,6 +41,8 @@ soeLocal = 2 -- the bug
|
|||
print(someLocal)
|
||||
```
|
||||
|
||||
Because of this, Luau type checker currently emits an error whenever a non-function global is used; use local variables instead.
|
||||
|
||||
## Structural type system
|
||||
|
||||
Luau's type system is structural by default, which is to say that we inspect the shape of two tables to see if they are similar enough. This was the obvious choice because Lua 5.1 is inherently structural.
|
||||
|
|
Loading…
Reference in a new issue