Dear Sébastien,

Thanks for your prompt response.

At Sat, 23 Apr 2016 20:56:55 +0200,
Sébastien Helleu wrote:
>
> On Sun, Apr 24, 2016 at 02:29:20AM +0900, AYANOKOUZI, Ryuunosuke wrote:
> >
> > I have a question about C and Script (Python) API for 'hook_process'.
> >
> > 1. For C API case, If 'const char *command' is set "func:get_status",
> >    function 'get_status' is NEVER called by both parent and child process.
> > 2. For Python API case, If 'command' is set "func:get_status",
> >    function 'get_status' IS called by child process.
> > Is my understanding correct?
> >
>
> Yes, in C API, the callback (of hook_process) is called in the child process,
> and then this callback can do anything with the command received (which is
> "func:name"). So the function name is not really used (the callback can use it
> if needed).
>
> The behavior is different in scripting API, the callback is called too, and 
> this
> callback runs the function after "func:", so the callback is called only one
> time in script, after the call to function in child.

OK, I understand.

In that behavior,
explicitly specifying function name like "func:get_status" in C example
may drive people to expect that the function 'get_status' is called.
Just "func:" is better I think.

And the following sentence[1] may also drive people to expect that
the function "name" is executed independently from the code of callback
even for C API case.
I think the expression of a paragraph with the sentence should be reconsidered.

[1] The command can also be a function name with format:
    "func:name", to execute the function "name" (WeeChat ≥ 1.5).

Making difference between C API and scripting API clear,
It would be nice if explanation of the behavior of
forking process, executing function, and calling callback is mentioned.

I attached a patch for quick fix,
I would appreciate if you review and, if possible, commit it to your repository.

I am awaiting for your reply.

Sincerely yours,
Ryuunosuke Ayanokouzi
--
AYANOKOUZI, Ryuunosuke <[email protected]>

Attachment: 0002-doc-update-description-of-functions-in-hook_process.patch
Description: Binary data

Attachment: pgp8QUAGSXRx6.pgp
Description: OpenPGP Digital Signature

_______________________________________________
Weechat-dev mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/weechat-dev

Reply via email to