Skip to content

Add type assertion syntax for runtime type checking. #8

@profan

Description

@profan

Right now, I assert that a lot of things are numbers, tables, non-null etc in function bodies, but it would be nice if we could automate these asserts with some nice syntax.

function(x, y, z)
    assert(x ~= nil)
    assert(y ~= nil)
    assert(z ~= nil)
end

would become

function(x?, y?, z?)
end

where the compiler would then insert the code we'd have written by hand normally.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions