Skip to content

serde integration, or custom proc macro for function arguments #294

@samuelcolvin

Description

@samuelcolvin

Code like this is ugly, and similar code will exist in lots of places

pub(crate) fn init(heap: &mut Heap<impl ResourceTracker>, args: ArgValues, interns: &Interns) -> RunResult<Value> {

We should support parsing args/kwargs into a struct using serde::Deserialize if it can support all forms of arguments, or a custom procedural macro if it can't.

So you would do something like

#[derive(serde::Deserialize)]
struct FunctionArgs {
  #[args_kwargs]
  a: i64,
  #[kwarg_only]
  b: String,
}

Metadata

Metadata

Assignees

No one assigned

    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