Typed arrays #2840
Denneisk
started this conversation in
Suggestions
Typed arrays
#2840
Replies: 1 comment 2 replies
-
The possibility of this is the only reason why arrays and tables aren't already using [1, 2, 3] or {1 = 2} syntax. Lambdas too, but I think their usefulness outweighs the potential future typed version that would take another year or however long to actually implement. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Have arrays that can only be filled with a certain type. This allows for a performance improvement by not needing to type check on runtime. This also can help solve #2785 by implementing an alternative to vector2/4, however,
array(123, 456)[number]
is a lot harder to write thanvec2(123, 456)
. Ideally, and with a future syntax, the compiler could coerce[123, 456]
into a typed array when used as a literal in a function call.Syntax?
The type system might need some extensions (generics, or just heavyhanded inheritance) to handle this, however.
Beta Was this translation helpful? Give feedback.
All reactions