Skip to content

syntax for computed keyword argument names #7704

Closed

Description

Bit of a confusing title, sorry. Basically I've found myself in positions where I need to invoke a function with named args that I've been passed dynamically:

# like so...
fn_to_call(; some_arg = 123) = println("woooo: $some_arg")
arg_name = :some_arg
arg_val = 678

# I want to invoke my function! The syntax currently supported goes like so:
fn_to_call(; [(arg_name, arg_val)]...)

# Don't get me wrong, that's pretty sweet, but personally I think it could be even more straightforward... like:
fn_to_call(; $arg_name = arg_val)

As I'm writing this I'm starting to think this could cause horrible problems when defining functions inside of macros... but maybe I'm wrong. Either way I'd be interested to hear what people think!

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

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions