Closed softprops closed 5 years ago
One notable drawback to this that I just realized while testing is that this limits a crate to one function as each func makes a call out to the initializer macro. This may be fine for many projects but it's notably limiting. Going to see if there's a way to limit this restriction
If we still have the old macro I’m not worried about that restriction for 0.3.0 as long as we document it and open an issue for resolving it.
Cool cool. Did have any thoughts/opinions on the attribute name? Rust can have attribute names that clash with macro names in the new unified path model otherwise I would have opted for just #[lambda]
. Lambdafn is concise enough I think but I'm open to suggestions.
#[lambdafn]
is a good name given that restriction.
now that proc-macro works on stable I wanted to introduce a new way to export lambda functions with crowbar, attributing bare functions. This is something I'm also experimenting with the lando crate. Included in this pull is a doc example but in a nut shell the idea is simple. Any function with the attribute
#[lambdafn]
will get its declaration parsed expecting two args ( assuming event and context ) and a return value. its function name will get used to synthesize.I think this is going to be a direction more crates are taking so I wanted to give this an early try in crowbar.
Initial thoughts I had were me wanting to reuse lambda for the proc-macro name
#[lambda]
but that conflicts with the declarative form.lambdafn
was kind of comprise but I'm open to suggestions.Let me know what you think @ilianaw.