Skip to content

bridge macro: client needs ability to specify an argument is the return type #220

Description

@gpwclark

old ticket exported from SLVM but needs a new TODO # and i need to bother to think about this more so i can either address it or remove the TODO from the code b/c what i'm currently doing works well enough.

below is extracted from: sstanfield/slvm#7

/// my slosh function!
#[sl_sh_fn]
fn myfun<'a>(#[return] arg1: &'a str, arg2: &str) -> &'a str {
...
}

to avoid needing to parse lifetimes for functions, when returning a reference specify with a #[return] macro (or something) that a given slosh value is also the value that will be returned. This can dramaticaly simplify the macro code while allowing a user to still write code that compiles in rust but is also performant in slosh.

e.g. the extant value problem and some related cases.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions