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

Introduce sanity to the signal emission/connection. #2

Open
nemerle opened this issue Sep 3, 2019 · 1 comment
Open

Introduce sanity to the signal emission/connection. #2

nemerle opened this issue Sep 3, 2019 · 1 comment
Labels
enhancement New feature or request

Comments

@nemerle
Copy link
Collaborator

nemerle commented Sep 3, 2019

Just take a look at the following bit of logic from HTTPRequest class:

bool HTTPRequest::_handle_response(bool *ret_value) {

    if (!client->has_response()) {
        call_deferred("_request_done", RESULT_NO_RESPONSE, 0, PoolStringArray(), PoolByteArray());
        *ret_value = true;
        return true;
    }

call_deferred("_request_done" is basically storing a function-to-call later as a name + args
and _request_done is a function of this class, registered here:

MethodBinder::bind_method(D_METHOD("_request_done"), &HTTPRequest::_request_done);

That will be looked-up by StringName ( slightly accelerated form of interning string class )
So we perform some string construction, lookups, etc, just to do something that in Qt is a simple

connect(this,&HTTPRequest::request_done,this,&HTTPRequest::on_request_done,Qt::QueuedConnection);

And without mentioning Qt at all, this can be done using a queue storing std::function'like objects instead.

@nemerle nemerle added the enhancement New feature or request label Sep 3, 2019
@nemerle
Copy link
Collaborator Author

nemerle commented Sep 28, 2022

This is mostly 'done' for signal handlers ( replaced with Callable types ), the other part of the equation -> 'signals' are still plain strings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant