Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support non-literal-closures for VTag event handlers #733

Closed
hgzimmerman opened this issue Nov 11, 2019 · 3 comments
Closed

Support non-literal-closures for VTag event handlers #733

hgzimmerman opened this issue Nov 11, 2019 · 3 comments

Comments

@hgzimmerman
Copy link
Member

hgzimmerman commented Nov 11, 2019

Description

I'm submitting a bug report/feature

When creating callbacks inside the html! macro, you can use tuple-function syntax (eg: callback=Some if Option<_> is the component's message type) instead of providing a normal closure (eg callback=|x| Some(x)) when you create components.
For some reason, this isn't possible for event handlers in Vtags. where oninput=Some will cause the html! macro to complain about it expecting a closure in the form of |_| Etc...

I don't see an immediate reason why this syntax couldn't be supported and I think the proc macro is being a little too conservative.

This strikes me as a regression because I thought this might have been possible at some point, but I can't recall exactly when it happened. I lack specific examples, but will update this issue as I find more specific information.

@jstarry
Copy link
Member

jstarry commented Nov 28, 2019

@hgzimmerman this will no longer be supported for both components and tags when this change lands: #756 FYI

@hgzimmerman
Copy link
Member Author

I see that this is fine given that oninput=self.link.callback(Some) should now work. Granted, you are typing more characters, but at least "tuple-functions" should work as intended in both vtags and components.
Close this upon completion of #756.

@jstarry
Copy link
Member

jstarry commented Dec 8, 2019

Closed because #783 removes support for transforming closures into callbacks

@jstarry jstarry closed this as completed Dec 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants