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

Constructor interception feature #45

Closed
mfkl opened this issue Dec 11, 2017 · 3 comments
Closed

Constructor interception feature #45

mfkl opened this issue Dec 11, 2017 · 3 comments
Assignees

Comments

@mfkl
Copy link

mfkl commented Dec 11, 2017

Following up on #44 regarding constructor interception.

Should I add it before or after base class call…

For my personal use case, I'd need to be able to run code before anything (including the base class call).

Should it be around the original constructor body

What's the other option? Inside the actual constructor body? Don't think that changes anything for me either way but other people might prefer the injected code to be run outside of the body?

Does it make sense to have a try-catch

It does not affect my particular use case, but I'd say yes. To remain consistent with the interception API for methods and properties, for one. And because user code can always throw and they might want to handle it.

@reflection-emit
Copy link
Collaborator

@mfkl
Copy link
Author

mfkl commented Dec 15, 2017

Awesome! Good job.

Cherry on cake would be to able to do conditional base calls (https://code.videolan.org/videolan/libvlcpp/blob/master/vlcpp/MediaDiscoverer.hpp#L92), but that seems hard to do since Attributes can't take Actions as constructors...

@reflection-emit
Copy link
Collaborator

Hmmm... That should be possible somehow... Let me think about that.

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