Local Table Destructuring#223
Conversation
|
|
Is this syntax reserved for future? |
|
Could you put some simpler examples for clarity, and include notes on how this works with array-likes, classes, and extern types on the RHS? |
No, its a function call. |
This is already valid syntax for a table call on a function named const const = function(t: { s: string })
print(t.s)
-- do smth with t
end
const { s = "meow" } -- this is a function calledit: jack hit post first and don't trust the syntax highlighter (it's wrong) |
What about a special character indicating destructuring? local @{ print, warn } = log
const @{ print, warn } = logor, if this is not optimal, restricting this destructuring syntax to local declarations (exclude constants) |
This isn't possible as outlined, at least not trivially. We could consider |
rendered
Note: I am fully aware of RFC 'Granural Imports', 'Table Destructing Syntax' proposals made by other people.
My RFC proposes simpler syntax, doesn't require new keywords, and is not limited to top-level scope with the usage of
require().