-
Notifications
You must be signed in to change notification settings - Fork 122
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
Function & constructor overloading #125
Comments
Tried to implement some kind of function selecting behaviour. |
Hi, yes, there was such a request earlier in #41. The issue as I see, is the overloaded functions dispatching can be resolved only at run-time, since an overloaded C++ wrapped function can be invoked in JavaScript with any argument list. So a generic Current |
Hmm, I tried to implement simple function wrapping this morning.
Output will be
How it works:
And if there is match, it gets function pointer with current index from So this approach is half-runtime half-compiletime (and it relies on template instantiation recursion =), and for any functions sequence passed will be generated new handler, but it is quite fast and requires no runtime type checks... I hope you get the idea, because my English is very bad. Now I see that it will be hard to just add this functionality to |
Thanks for sharing the idea! I haven't thought before to use an array of functions with the same name for single |
Hi again) |
Hi,
thanks for sharing, and good luck with all your ideas!
Sincerely,
Pavel
пт, 6 сент. 2019 г. в 00:36, Alexander Seleznev <[email protected]>:
… Hi again)
Started implementing ideas inspired by your lib here:
https://github.com/ayles/v8bind
I'll later add link to v8pp in README.
Class member variables binding and multiple constructors binding works
fine,
will add function overloads binding later.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#125?email_source=notifications&email_token=AAISAUVECSREGHR3TVXWCPDQIGCX5A5CNFSM4ISOJYUKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD6BBF2I#issuecomment-528618217>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAISAUXWQBZ7BUTNA3ESPJDQIGCX5ANCNFSM4ISOJYUA>
.
|
I'm also intrested in possibility of setting functions and constructors like:
Then best match will be selected.
As far as I understand adding two or more functions is not as difficult as selecting wich one to use, cause here should be some rules like:
First, try find handler with same argument count.
Second, try find exact argument type match.
If there is no such handler, ...?
In any other case select handler with
(const FunctionCallbackInfo &)
signature if available.So, is it possible and do you have any thoughts about it?
The text was updated successfully, but these errors were encountered: