Skip to content

Add ability to trivially specify a Rust function or closure as a node's expression #156

@mitchmindtree

Description

@mitchmindtree

Currently, users need to write steel.

Ideally, users could write Rust and not have to think about steel if they don't want to for new nodes.

Function arguments will likely require TryFrom<SteelVal> and return types will require Into<SteelVal>.

Rough Example

    fn expr(&self, ctx: ExprCtx<Env>) -> Result<ExprKind> {
        gantz_core::expr_from_rust_fn(my_fust_fn)
    }
fn my_rust_fn(a: i32, b: i32) -> i32 {
    // ...
}

Open Qs

  • How to handle state? Dedicated fn that provides state: &mut T as final arg?
  • How to handle branching? Dedicated fn that returns a type implementing Branch? Maybe branch id derivable for enums, each variant associated with a branch index, and variant value Into<SteelVal>?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions