mirror of
https://github.com/luau-lang/luau.git
synced 2024-11-15 14:25:44 +08:00
Merge branch 'master' into merge
This commit is contained in:
commit
1f8ec89465
@ -8,6 +8,12 @@ This document tracks unimplemented RFCs.
|
||||
|
||||
**Notes**: Implementing this RFC triggers warnings across the board in the apps ecosystem, in particular in testing libraries. Pending code changes / decisions.
|
||||
|
||||
## Deprecate table.getn/foreach/foreachi
|
||||
|
||||
[RFC: Deprecate table.getn/foreach/foreachi](https://github.com/Roblox/luau/blob/master/rfcs/deprecate-table-getn-foreach.md)
|
||||
|
||||
**Status**: Needs implementation.
|
||||
|
||||
## Read-only and write-only properties
|
||||
|
||||
[RFC: Read-only properties](https://github.com/Roblox/luau/blob/master/rfcs/property-readonly.md) |
|
||||
@ -15,14 +21,8 @@ This document tracks unimplemented RFCs.
|
||||
|
||||
**Status**: Needs implementation
|
||||
|
||||
## String interpolation
|
||||
## Expanded Subtyping for Generic Function Types
|
||||
|
||||
[RFC: String interpolation](https://github.com/Roblox/luau/blob/master/rfcs/syntax-string-interpolation.md)
|
||||
|
||||
**Status**: Needs implementation
|
||||
|
||||
## Lower Bounds Calculation
|
||||
|
||||
[RFC: Lower bounds calculation](https://github.com/Roblox/luau/blob/master/rfcs/lower-bounds-calculation.md)
|
||||
[RFC: Expanded Subtyping for Generic Function Types](https://github.com/Roblox/luau/blob/master/rfcs/generic-function-subtyping.md)
|
||||
|
||||
**Status**: Implemented but not fully rolled out yet.
|
||||
|
31
rfcs/deprecate-table-getn-foreach.md
Normal file
31
rfcs/deprecate-table-getn-foreach.md
Normal file
@ -0,0 +1,31 @@
|
||||
# Deprecate table.getn/foreach/foreachi
|
||||
|
||||
## Summary
|
||||
|
||||
Mark table.getn/foreach/foreachi as deprecated
|
||||
|
||||
## Motivation
|
||||
|
||||
`table.getn` was deprecated in Lua 5.1 that Luau is based on.
|
||||
|
||||
`table.getn(x)` is equivalent to `rawlen(x)` when `x` is a table; when `x` is not a table, `table.getn` produces an error. It's difficult to imagine code where `table.getn(x)` is better than either `#x` (idiomatic) or `rawlen(x)` (fully compatible replacement). However, `table.getn` is slower and provides yet another way to perform an operation, leading new users of the language to use it unknowingly.
|
||||
|
||||
`table.foreach` and `table.foreachi` were deprecated in Lua 5.2.
|
||||
|
||||
`table.foreach` is equivalent to a `for .. pairs` loop; `table.foreachi` is equivalent to a `for .. ipairs` loop; both may also be replaced by generalized iteration. Both functions are significantly slower than equivalent `for` loop replacements, are more restrictive because the function can't yield, and result in new users (particularly coming from JS background) unknowingly using these thus producing non-idiomatic non-performant code.
|
||||
|
||||
In both cases, the functions bring no value over other library or language alternatives, and thus just serve as a distraction.
|
||||
|
||||
## Design
|
||||
|
||||
We will mark all three functions as deprecated. The only consequence of this change is that the linter will start emitting warnings when they are used.
|
||||
|
||||
Removing support for these functions doesn't provide any measurable value and as such is not planned in the foreseeable future because it may cause backwards compatibility issues.
|
||||
|
||||
## Drawbacks
|
||||
|
||||
None
|
||||
|
||||
## Alternatives
|
||||
|
||||
If we consider table.getn/etc as supported, we'd want to start optimizing their usage which gets particularly tricky with foreach and requires more compiler machinery than this is probably worth.
|
@ -1,5 +1,7 @@
|
||||
# Lower Bounds Calculation
|
||||
|
||||
**Status**: Abandoned in favor of a future design for full local inference
|
||||
|
||||
## Summary
|
||||
|
||||
We propose adapting lower bounds calculation from Pierce's Local Type Inference paper into the Luau type inference algorithm.
|
||||
|
Loading…
Reference in New Issue
Block a user