-
Notifications
You must be signed in to change notification settings - Fork 100
Description
Is your feature request related to a problem? Please describe.
as of now, our compiler is very dumb and works very much like "a".replace("a", "b")
. we ran into the bottleneck of being a very simple compiler when trying to create more advanced language features: #690, #466, #432, all of which required code scanning.
also, the current arrays implementation is not type safe and it can't be because of no code scanning:
let arr = [1];
let a = arr[56];
Describe the solution you'd like
there should be a compiler module that ""executes"" code at compile time to check for issues
Describe alternatives you've considered
the closest to a code scanning solution we have is bshchk
, but it is not an amber project and is limited to only external dependencies.
Additional context
i think we could look at the way typescript has implemented its typing system, as it is widely used and very close to what we might want:
let maybe_string = "a" as string | number;
if (typeof maybe_string === "number") {
// typescript knows that maybe_string is number here
}