wduquette / molt

Embeddable TCL Interpreter for Rust applications
BSD 3-Clause "New" or "Revised" License
103 stars 12 forks source link

Passing closures to `add_command`? #106

Open MarkLagodych opened 2 years ago

MarkLagodych commented 2 years ago

Currently, only functions can be passed to add_command. I think it would be more useful if closures were accepted too. Could you please implement this functionality?

wduquette commented 2 years ago

Hi, Mark!

I implemented it using functions because I could figure out how to do it with functions without running afoul of the borrow checker. (I'm still at best an intermediate Rust programmer.) You're welcome to fork Molt and give it a try, though.