Subject: Re: bug#64919: 28.2; jsonrpc.el: jsonrpc-lambda failed to deal with single value

From: Yue Yi <[email-masked]>
Date: Sat, 29 Jul 2023 21:17:56 +0900

Hello João:

> That's a great idea.  Have you looked at the jsonrpc.el test application
> in test/lisp/jsonrpc-tests.el?  It has a simple application, but it's
> not very well commented, so a well-described tutorial that does a
> similar simple application is welcome.

I haven't read it yet and I will.

> Doing jsonrpc-async-request without success-fn is possible but oesn't
> make much sense, becase there's nothing to react to whatever the server
> returned for this remote proceedure call if the request succeeds.

You're right and what I want to do is to see what will happen if I don't
use :success-fn.

> By the way, this isn't how you make objects in Common Lisp (or in Emacs
> Lisp's emulation of it, which is what we have here).  You would have to
> use 'make-instance'

Yes, 'make-instance' is the better one.

> You should first be able to describe in plain English what you want this
> tutorial example to showcase.  Do you want to make a simple JSONRPC
> client that asks the endpoint to perform elementary arithmetic remotely?
> Fine.  Where do you want the remote endpoint to live?  The same Emacs?
> Another Emacs?  Another process running a program written in another
> language?

All these problems are indeed things I need to consider if I want to write
an
example using JSON-RPC. My initial idea was simply to use RPC in
Emacs to access some functionalities of Python.

> As I said, it's a very good idea in principle.  But from your
> description of it, it seems still a bit fuzzy.

Yeah. While writing this example, I assume that the user acts as the
transport layer
for RPC messages: manually calling 'jsonrpc-connection-send' and
'jsonrpc-connection-receive'
to achieve message transmission. My initial intention is to let readers of
the
tutorial get a simple understanding of how jsonrpc.el works.

> I _think_ you first want to do 1, to get a feeling of how to use the
> library as an application writer.  Only then should you move on to 2 to
> understand how to user the library an implementor of new transports.

can't agree more.

In summary, first, I need to consider with whom I will perform RPC and
address some of the details mentioned above. Afterward, I can proceed to
plan and write the tutorial.

I will carefully consider the suggestions above on how to better introduce
the usage of jsonrpc.el. When I believe that my work is well-prepared, I
may consider submitting a request to emacs-devel for review and feedback.

Regards

YI YUE