From debbugs-submit-bounces@debbugs.gnu.org Fri Jul 28 13:26:54 2023 Received: (at submit) by debbugs.gnu.org; 28 Jul 2023 17:26:54 +0000 Received: from localhost ([127.0.0.1]:46052 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qPREs-0001Nt-7Z for submit@debbugs.gnu.org; Fri, 28 Jul 2023 13:26:54 -0400 Received: from lists.gnu.org ([2001:470:142::17]:58062) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qPQoK-0000bo-Q1 for submit@debbugs.gnu.org; Fri, 28 Jul 2023 12:59:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qPQoF-0005PR-J9 for bug-gnu-emacs@gnu.org; Fri, 28 Jul 2023 12:59:23 -0400 Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qPQoD-0004Dh-SL for bug-gnu-emacs@gnu.org; Fri, 28 Jul 2023 12:59:23 -0400 Received: by mail-wr1-x429.google.com with SMTP id ffacd0b85a97d-3159d5e409dso2547037f8f.0 for ; Fri, 28 Jul 2023 09:59:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690563560; x=1691168360; h=cc:to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=cReG8r5B1N8h8uv876S0d6h7FfWR/P1xEe2b7TPzblc=; b=CPFCpfzxpAJcoHFvgYKKQ4vRosEbu46CRfSsd6BmTSG57rrIZ0Zim+oPvOEzDEzk4U fxAE7ySwWOtvCy4GC9hgSRrT0vLAyYPKEWHa4Qw0qyee20yXmJ+0J9UT669kqMcK4i4Y o4weMXdS2/IrXVAjwwX73CzMj16jSWJXQ+/3ZnGVIwP6OWp0lCSIP5sxEdNJXl2bfuiz lUzwc5bGD4E/AMBHwFGfB0d+JDWP88MqZZBKZFQluZjPsrs7r53PgXsiOtQm+NYR6aQy eBrBeMr40hVe0olq+hYKgSQt1lMWw5MivHL0o6E2/ycHkUiWbinMYTwFaV5v6DHAp6UV 9p3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690563560; x=1691168360; h=cc:to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=cReG8r5B1N8h8uv876S0d6h7FfWR/P1xEe2b7TPzblc=; b=UqvJzJzRmb7QJhxjlNBn1P1QLaqRx9y7K7G7FdCgqtlaUG1egASSYdPPY177z1/as2 1rlkmF7waAwcUrxDFNiI70D0tOioKfP/07uMW56wAkpAy69VaPmzMFEhmGfmNDniD1bw ASI3xZiKJO91M21alMLHVhfX23TkHjHf8Of2Lrkgof2tmNEjV5CFBeWnIvKDzkCkeXsN nKg7y89ZK2Fyd/eJQ/IdkhZmhOuSvnZ2oY2v5tN/yyHCrxQJLYUBFz5IWYKl/0QE+nvX uYeI1j/OACYrn1p2qAYHRhNhdpeaGnCzG3NGrrw0f6ItjHs5w4EtS0/KYxLb0hxuSMgL rhJw== X-Gm-Message-State: ABy/qLZnvAGuEPrVcLx/gOW3u84zbsSOhXi5iY8/2Uq8oY55HqOsNgMy XCVRVldmK19weFjWoCL/2LhBiFoA77bazUI3ZsD1OhS9i3k= X-Google-Smtp-Source: APBJJlF2CSDSsZOkBSigYpx27Cz3zwMC8sMEdjUuvIpM0tiavtdhLv6b5NXH7xM8/9NiOKhP5s2tawY/DHJRj7NJ1ME= X-Received: by 2002:adf:e6c4:0:b0:314:9dc:4c4 with SMTP id y4-20020adfe6c4000000b0031409dc04c4mr2365013wrm.2.1690563559941; Fri, 28 Jul 2023 09:59:19 -0700 (PDT) MIME-Version: 1.0 From: Yue Yi Date: Sat, 29 Jul 2023 01:59:09 +0900 Message-ID: Subject: 28.2; jsonrpc.el: jsonrpc-lambda failed to deal with single value To: bug-gnu-emacs@gnu.org Content-Type: multipart/alternative; boundary="00000000000075ea9706018f00e0" Received-SPF: pass client-ip=2a00:1450:4864:20::429; envelope-from=includeyy123@gmail.com; helo=mail-wr1-x429.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 1.2 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Currently I'm trying to write an toturial about using JSON-RPC in Emacs, so I spent some time to read the source code and document and found #bug64888. Here is another bug I find: When I do a async request through `jsonrpc-async-request' without specifing :success-fn, emacs will signal an error. Here is the code I use: Content analysis details: (1.2 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_HELO_PASS SPF: HELO matches SPF record 1.0 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) 0.2 FREEMAIL_ENVFROM_END_DIGIT Envelope-from freemail username ends in digit (includeyy123[at]gmail.com) 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (includeyy123[at]gmail.com) 0.0 HTML_MESSAGE BODY: HTML included in message -0.0 T_SCC_BODY_TEXT_LINE No description available. X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Fri, 28 Jul 2023 13:26:52 -0400 Cc: =?UTF-8?B?Sm/Do28gVMOhdm9yYQ==?= X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.2 (/) --00000000000075ea9706018f00e0 Content-Type: text/plain; charset="UTF-8" Currently I'm trying to write an toturial about using JSON-RPC in Emacs, so I spent some time to read the source code and document and found #bug64888. Here is another bug I find: When I do a async request through `jsonrpc-async-request' without specifing :success-fn, emacs will signal an error. Here is the code I use: --- (defclass yy-rpc (jsonrpc-connection) ((place :initarg :place :accessor yy-place))) (cl-defmethod jsonrpc-connection-send ((conn yy-rpc) &key id method params result error) (setcar (yy-place conn) (append (if id `(:id ,id)) (if method `(:method ,method)) (if params `(:params ,params)) (if result `(:result ,result)) (if error `(:error ,error))))) (setq a (cons nil nil)) (setq b (yy-rpc :name "1" :place a)) (jsonrpc-async-request b "add" [1 2]) (jsonrpc-connection-receive b '(:result 3 :id 1)) --- I just make a very simple subclass `yy-rpc' and response to it "by hand", after evaluating the above code, I get: --- Debugger entered--Lisp error: (wrong-type-argument listp 3) --- By reading the code of `jsonrpc--async-request-1', I find the default :success-fn callback uses the macro jsonrpc-lambda and I know why it happened: --- (funcall (jsonrpc-lambda (&rest _ignored) nil) 3) => Debugger entered--Lisp error: (wrong-type-argument listp 3) --- It seems that `jsonrpc-lambda' cannot handle single value. Maybe We can change its last line from `(lambda (,e) (apply (cl-function (lambda ,cl-lambda-list ,@body)) ,e)))) to `(lambda (,e) (apply (cl-function (lambda ,cl-lambda-list ,@body)) ,e ()))) After change it and M-x eval-buffer, I can get the right behavior using the code above. Is it the right way? Regards YI YUE --00000000000075ea9706018f00e0 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Currently=
 I'm trying to write an toturial about using JSON-RPC in Emacs, so I sp=
ent some time to read the source code and document and found #bug64888.
=C2=A0
Here is another b=
ug I find: When I do a async request through `jsonrpc-async-request' wi=
thout specifing :success-fn, emacs will signal an error. Here is the code I=
 use:
=C2=A0
--- 
(defclass yy-rpc (jsonrpc-connection)
=
=C2=A0 ((place
=C2=A0=C2=A0=C2=A0 :initarg :place
=
=C2=A0=C2=A0=C2=A0 :accessor yy-place)))
(cl-defmethod jsonrpc-connection-send ((conn yy-rpc)
=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
 =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 &key id method params result erro=
r)
=C2=A0 (setcar (yy-place conn)
=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 =C2=A0 (append (if id `(:id ,id)=
)
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 =C2=A0 (if method `(:method ,method))
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0 =C2=A0 (if params `(:params ,params))
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0 =C2=A0 (if result `(:result ,result))
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0 =C2=A0 (if error=C2=A0 `(:error=C2=A0 ,error)))))
(setq a (cons nil nil))
(setq b (yy-rpc :nam=
e "1" :place a))
=C2=A0
(jsonrpc-async-request b "add" [1 2])
(jsonrpc-connection-receive b '(:result 3 :id 1))
---
=C2=A0
I jus=
t make a very simple subclass `yy-rpc' and response to it "by hand=
", after evaluating the above code, I get:
=
=C2=A0
---
Debugger entered-=
-Lisp error: (wrong-type-argument listp 3)
---
=C2=A0
By reading the code of=
 `jsonrpc--async-request-1', I find the default :success-fn callback us=
es the macro jsonrpc-lambda and I know why it happened:
=C2=A0
---
(funcall =
(jsonrpc-lambda (&rest _ignored) nil) 3)
=3D> De=
bugger entered--Lisp error: (wrong-type-argument listp 3)
---
=C2=A0
It se=
ems that `jsonrpc-lambda' cannot handle single value. Maybe We can chan=
ge its last line from
=C2=A0
`(lambda (,e) (apply (cl-function (lambda ,cl-lambda-list ,@body)) =
,e))))
=C2=A0
to
=C2=A0
`(lambda (,e) (app=
ly (cl-function (lambda ,cl-lambda-list ,@body)) ,e ())))
=C2=A0
After change it and M-x eval-=
buffer, I can get the right behavior using the code above.
=C2=A0
Is it the right way?
=C2=A0
Regards
=C2=A0
YI Y=
UE
--00000000000075ea9706018f00e0-- From debbugs-submit-bounces@debbugs.gnu.org Sat Jul 29 06:11:49 2023 Received: (at 64919-done) by debbugs.gnu.org; 29 Jul 2023 10:11:49 +0000 Received: from localhost ([127.0.0.1]:46452 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qPgvM-0005Q7-Db for submit@debbugs.gnu.org; Sat, 29 Jul 2023 06:11:49 -0400 Received: from mail-ed1-x531.google.com ([2a00:1450:4864:20::531]:50289) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qPgvK-0005Pt-Jy for 64919-done@debbugs.gnu.org; Sat, 29 Jul 2023 06:11:47 -0400 Received: by mail-ed1-x531.google.com with SMTP id 4fb4d7f45d1cf-51e2a6a3768so3809876a12.0 for <64919-done@debbugs.gnu.org>; Sat, 29 Jul 2023 03:11:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690625500; x=1691230300; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=UI00aIhoJUGFSKpHDdgorLXMq1EdLTTBxWkNw+6iG1s=; b=gMOVBIWN3howcRBH4O7LJQZnd/ms4c9Sv9UKiJS2Fx/cLwz314MHxsAkIUGhhAAa2j TGGhdpKgeXAuvt8UnGyHnK57rYb3UWTB1AyOcheq/OQ4/zfbvsuqud+AaDPyClFvE4Te aE4VJfWhUT3GQSGBx6D0+BYwguUr3qmu40LvhS2p6VLEZHOzNbjeCuToP57JsbaqTxmC 7d0HFc+ODdjM2A3x0/Z8E7BQW3i1XV8902ecDQ5io/2KXqDtZl/obA6cZLzkVw4Yegpd U7UiQnI6c/sFGfGGoi9JfzOsBfqiiQArzTQedi9D8ZDruBrF5AnjIvyuUbRI/geUur8D C5OA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690625500; x=1691230300; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=UI00aIhoJUGFSKpHDdgorLXMq1EdLTTBxWkNw+6iG1s=; b=kfvLo6jhprNtIOZvsyugbKvETh5OwJD8JP8sEnNlrWU0ip7fIMVyTGA04bfaVVJMoL sqfCVuBbLQyx++HVep/lGhaHR2TXHZcJcXURpFD//tIWZNWmTkiKY4c+qu8O3BGZ3oEo adj/+whF0Gh0+Wuzo6aTNiHzOqxI6d0zO2nhSR/9R+IOAn0r/GwikyrbFVpHn6Xkqk5X DnjVXkj+WywrqXP2zrU0VzjO/RjHt4rTS36G6Uk8fhbAs1IHJtYJVJ8ZkBrZZcANk1Yl PZT54zn9+ZaRzLF6SOKqd495uNgm5TAiIMXbADYamGIkx6odagGLlpet63/ayBF64HcB XFPw== X-Gm-Message-State: ABy/qLaydo/SwicuC3Mmc6GdIEippxHpr/zhQX8sqtsJJYyaR8fDYC+V EZS8ZWbviT+YAtWXGIS6yxogcYMtEfY= X-Google-Smtp-Source: APBJJlEzZiYJg9gttOki2jKjuBvfAtAhCzTsSrPaAfmzPDACXFDI+PTaCg5Lli6lMJUeiiIhU6OP8A== X-Received: by 2002:a17:906:76c8:b0:965:fb87:4215 with SMTP id q8-20020a17090676c800b00965fb874215mr1856970ejn.15.1690625499825; Sat, 29 Jul 2023 03:11:39 -0700 (PDT) Received: from krug ([87.196.73.190]) by smtp.gmail.com with ESMTPSA id w17-20020a05600c015100b003fbfef555d2sm8835708wmm.23.2023.07.29.03.11.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 29 Jul 2023 03:11:39 -0700 (PDT) From: =?utf-8?B?Sm/Do28gVMOhdm9yYQ==?= To: Yue Yi Subject: Re: bug#64919: 28.2; jsonrpc.el: jsonrpc-lambda failed to deal with single value In-Reply-To: (Yue Yi's message of "Sat, 29 Jul 2023 01:59:09 +0900") References: Date: Sat, 29 Jul 2023 11:14:17 +0100 Message-ID: <87wmyjgh3a.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 64919-done Cc: 64919-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hello Yue Yi, Yue Yi writes: > Currently I'm trying to write an toturial about using JSON-RPC in > Emacs, so I spent some time to read the source code and document and > found #bug64888. 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. > Here is another bug I find. Yes, you've found a bug. I have fixed it in master 3bbe6f4abc6c1dd8f414e48af5b6ce344bce34db. I have closed this bug, but we can keep chatting. But read on because I think you are misunderstanding the library in some aspects. > When I do a async request through `jsonrpc-async-request' without > specifing :success-fn, emacs will signal an error. Here is the code I > use: 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. =20=20 > ---=20 > (defclass yy-rpc (jsonrpc-connection) > ((place > :initarg :place > :accessor yy-place))) > (cl-defmethod jsonrpc-connection-send ((conn yy-rpc) > &key id method params result error) > (setcar (yy-place conn) > (append (if id `(:id ,id)) > (if method `(:method ,method)) > (if params `(:params ,params)) > (if result `(:result ,result)) > (if error `(:error ,error))))) > (setq a (cons nil nil)) > (setq b (yy-rpc :name "1" :place a)) 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' I also don't understand what your code is supposed to perform. Look at=20 the test/lisp/jsonrpc-tests.el to get an idea of how to do these kinds of servers. 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? Try to first answer these questions and have a very clear idea in your head of what you want to demonstrate in the tutorial. As I said, it's a very good idea in principle. But from your description of it, it seems still a bit fuzzy. > (jsonrpc-async-request b "add" [1 2]) > (jsonrpc-connection-receive b '(:result 3 :id 1)) Here is what may be a significant mistake: the 'jsonrpc-connection-receive' is not meant to be called by the _application_ writer. Instead it is meant to be called by the _library_ writer, i.e. someone who is extending 'jsonrpc.el' to a new transport (other than TCP/IP sockets). In other words, you're mixing up two ways to use jsonrpc.el. They are both described in 33.32.1 JSONRPC Overview 1. A user interface for building JSONRPC applications 2. A inheritance interface for building JSONRPC transport implementations Thse are two completely separate use cases. 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. Only then you'll get to mess with 'jsonrpc-connection-receive', which you're doing right now. Jo=C3=A3o From debbugs-submit-bounces@debbugs.gnu.org Sat Jul 29 09:31:01 2023 Received: (at 64919) by debbugs.gnu.org; 29 Jul 2023 13:31:01 +0000 Received: from localhost ([127.0.0.1]:46608 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qPk28-0005MB-Ro for submit@debbugs.gnu.org; Sat, 29 Jul 2023 09:31:01 -0400 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]:61782) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qPith-0003Gr-31 for 64919@debbugs.gnu.org; Sat, 29 Jul 2023 08:18:13 -0400 Received: by mail-wr1-x42b.google.com with SMTP id ffacd0b85a97d-31763b2c5a4so3111799f8f.3 for <64919@debbugs.gnu.org>; Sat, 29 Jul 2023 05:18:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690633087; x=1691237887; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=60L4vpJFzJFi/24Cfn+x6vfOkYJerCY2Cr0cAq4REEI=; b=LDpmi3PGT+/+PuihG8Pi6hnukGUkJ/3DUnYmuzstdWugfDq/sX5Dz+HuFw+4aqVFbf vtpMvHCW3EwPLwH/aTqIlaKQ5mIsrA57INQ9oPdsran+RNjLADLirN1d/megHBImVzSg qUYBu2uM8SNbXpRY9e1Gl8bDiMehdo68tcRX6Pla8wP2pfMq+pms9xeJfFKB/gCryAd+ 8ZFQgtPBsY7evwU416mBYMbpN3v+zyf8BzKTzkvUagyTAX6LlLJjCmAVRMLLdhQCd3oa eyExYjH+3KzBpTy3itTNZ8YXcYuI6igmJs4EuZpqIiT7eE8OAykEICcocY7Kwh4cqHtF D1NQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690633087; x=1691237887; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=60L4vpJFzJFi/24Cfn+x6vfOkYJerCY2Cr0cAq4REEI=; b=jjvmPv39u6G5s9f3dAUFsif1jTPgklHF7XB3NH0sJuJOaBtWxxv6+Pp5mpzhRN03G/ Bkg7Yi2Dt923meX7VwBEuw/eiS3/4L1y749zX9Kh2AV6YwAUzCNZUamr9d51bJGUU021 DhQ93NLamG1oqCXGX/ScTIHER1G2W9xtauFJV4zwCfZkb8gGxzh0awM6zSWAWzfwfghk Q40lyPsXbCJHMDNcKvzCNg1jG3qL4qdLABtTBSZVhqBDuyUnz+2YlkTIdwcvNHJY4Fcj rvp1qX/CzA2os2WsW9dkPvUzMFmvJk71E84k6HUcL0iOnweTxR74lopQ/LhwlxCWDIAg /1eQ== X-Gm-Message-State: ABy/qLZ6TWXlbm/vEZRrgjVZKgR3ohluf66K3K0YLQIg/EG6lrWFzLo3 ihZXMLOGZpPDYfsq+yNPVfzJAP923N7QsX3QHEU= X-Google-Smtp-Source: APBJJlEnCYC8XBicrdRZf6MyAvxzBgijHoiz5pJoGdOMa2A7KsENNuRzFsUcr6y9HsbTY/8LyhVThSFthh7JY463W+o= X-Received: by 2002:a5d:458a:0:b0:313:e520:936f with SMTP id p10-20020a5d458a000000b00313e520936fmr4536120wrq.17.1690633086994; Sat, 29 Jul 2023 05:18:06 -0700 (PDT) MIME-Version: 1.0 References: <87wmyjgh3a.fsf@gmail.com> In-Reply-To: <87wmyjgh3a.fsf@gmail.com> From: Yue Yi Date: Sat, 29 Jul 2023 21:17:56 +0900 Message-ID: Subject: Re: bug#64919: 28.2; jsonrpc.el: jsonrpc-lambda failed to deal with single value To: =?UTF-8?B?Sm/Do28gVMOhdm9yYQ==?= Content-Type: multipart/alternative; boundary="000000000000988d9b06019f3056" X-Spam-Score: 0.2 (/) X-Debbugs-Envelope-To: 64919 X-Mailman-Approved-At: Sat, 29 Jul 2023 09:30:59 -0400 Cc: 64919@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.8 (/) --000000000000988d9b06019f3056 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hello Jo=C3=A3o: > 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 --000000000000988d9b06019f3056 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hello=C2= =A0Jo=C3=A3o:=

> That's a great idea.=C2=A0 Have you looked at th= e jsonrpc.el test application
> in test/lisp/jsonrpc-tests.el?=C2=A0 = 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 y= et and I will.

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

You're right and what I want to do is to see what will ha= ppen 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, wh= ich is what we have here).=C2=A0 You would have to
> use 'make-in= stance'

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

> You should first= be able to describe in plain English what you want this
> tutorial e= xample to showcase.=C2=A0 Do you want to make a simple JSONRPC
> clie= nt that asks the endpoint to perform elementary arithmetic remotely?
>= ; Fine.=C2=A0 Where do you want the remote endpoint to live?=C2=A0 The same= Emacs?
> Another Emacs?=C2=A0 Another process running a program writ= ten in another
> language?

All these problems are indeed things I need = to consider if I want to write an=C2=A0
exa= mple using JSON-RPC.=C2=A0My initial idea was simply to use RPC in=C2=A0
Emacs to access some functionalities of Pytho= n.

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

Y= eah.=C2=A0While writing this example, I assume that the user acts as the tr= ansport layer=C2=A0
for RPC messages: manually calling 'jsonr= pc-connection-send' and 'jsonrpc-connection-receive'
= to achieve message transmission. My initial intention is to let readers of = the=C2=A0
tutorial get a simple understanding of how jsonrpc.el w= orks.

> I _think_ you first want to do 1, to ge= t a feeling of how to use the
> library as an application writer.= =C2=A0 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, fi= rst, I need to consider with whom I will perform RPC and address some of th= e details mentioned above. Afterward, I can proceed to plan and write the t= utorial.

I will carefully consider the suggest= ions above on how to better introduce the usage of jsonrpc.el. When I belie= ve that my work is well-prepared, I may consider submitting a request to em= acs-devel for review and feedback.

Regards

YI YUE
--000000000000988d9b06019f3056-- From unknown Sat Sep 20 14:55:19 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sun, 27 Aug 2023 11:24:05 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator