Skip to content

Cannot reference function types from variables #90

Open
@SnirkImmington

Description

@SnirkImmington

Consider the protosnirk program

fn main()
    // empty

fn foo()
    let bar = main

We emit

%load_main = load void (), void ()* @main
%bar = alloca void main

for the line let bar = main.

From an LLVM perspective, we assume all variables can have allocas created for them and that they can be loaded from them. So we would need to handle the case of variable-sized types or a routine for determining the size of an alloca.

From a usability standpoint, C is the only language that I can think of that supports function pointers but not closures, so it might be a good idea to wait until we have those first...

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: checkCode validationarea: identifyThe "identify pass" - the ScopedId De Brujin index, or "ensure name exists in scope"area: llvmUsage of the LLVM compiler libraryissue: bugBug reportpriority: lowConsider higher priority issues firststatus: on-holdPR contributor away or more discussion needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions