Skip to content

function puns? (funs!) #47

@Gankra

Description

@Gankra

We support type puns...

pun "MetersU32" {
lang "rust" {
@repr "transparent"
struct "MetersU32" {
_ "u32"
}
}
lang "c" "cpp" {
alias "MetersU32" "u32"
}
}

Why not function puns?

fun "sick_call" {
    lang "rust" {
        fn "sick_call" {
            inputs { _ "[u64; 2]"; }
        }
    }

    lang "c" "cpp" {
        fn "sick_call" {
            inputs { _ "u64"; _ "u64"; }
        }
    }
}

I'm not sure exactly when we'd want this, but I wanted to write it down.

As with puns, there needs to be restrictions that allow us to keep the ValueTree in sync across puns. In the case of ValueTree we require there to be an equal number of Values (primitives + enum tags) produced (so [u32; 2] can pun (u32, u32), but u64 can't). So the above example might be an invalid fun.

A more realistic fun might be "varargs vs not".

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestquestionFurther information is requested

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions