Skip to content

[Feature] Code scanning / analyse solution #691

@b1ek

Description

@b1ek

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
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions