From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Ted Zlatanov Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] json: Add support for encoding structs Date: Tue, 25 Apr 2017 10:26:28 -0400 Organization: =?utf-8?B?0KLQtdC+0LTQvtGAINCX0LvQsNGC0LDQvdC+0LI=?= @ Cienfuegos Message-ID: <87d1c0pnqj.fsf@lifelogs.com> References: <874lxeq6mz.fsf@lifelogs.com> <87pog1pqdn.fsf@lifelogs.com> Reply-To: emacs-devel@gnu.org NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1493130406 21413 195.159.176.226 (25 Apr 2017 14:26:46 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 25 Apr 2017 14:26:46 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Apr 25 16:26:42 2017 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d31QQ-0005T3-2c for ged-emacs-devel@m.gmane.org; Tue, 25 Apr 2017 16:26:42 +0200 Original-Received: from localhost ([::1]:49710 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d31QV-0006QQ-PJ for ged-emacs-devel@m.gmane.org; Tue, 25 Apr 2017 10:26:47 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:59176) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d31QP-0006Q7-AT for emacs-devel@gnu.org; Tue, 25 Apr 2017 10:26:42 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d31QM-0002Yk-6D for emacs-devel@gnu.org; Tue, 25 Apr 2017 10:26:41 -0400 Original-Received: from [195.159.176.226] (port=36881 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1d31QL-0002Y2-Ut for emacs-devel@gnu.org; Tue, 25 Apr 2017 10:26:38 -0400 Original-Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1d31QB-0005BB-QI for emacs-devel@gnu.org; Tue, 25 Apr 2017 16:26:27 +0200 X-Injected-Via-Gmane: http://gmane.org/ Mail-Followup-To: emacs-devel@gnu.org Original-Lines: 27 Original-X-Complaints-To: usenet@blaine.gmane.org X-Face: bd.DQ~'29fIs`T_%O%C\g%6jW)yi[zuz6; d4V0`@y-~$#3P_Ng{@m+e4o<4P'#(_GJQ%TT= D}[Ep*b!\e,fBZ'j_+#"Ps?s2!4H2-Y"sx" Mail-Copies-To: never Cancel-Lock: sha1:e8qF/tMfqPeeHslz30/Yxou3GZo= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 195.159.176.226 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:214284 Archived-At: On Tue, 25 Apr 2017 18:10:59 +0530 Vibhav Pant wrote: VP> On Tue, Apr 25, 2017 at 4:22 AM, Davis Herring wrote: >> You could use :json "" or :json 'ignore as the special value. VP> IIRC, the empty string is a valid JSON key (`JSON.parse(`{"":1}`)` VP> works in JS). VP> Symbols are also considered a valid type according to VP> `json-encode-key'. Maybe one way is to distinguish '(:serialize-field nil) from '() by checking with memq for the key? On Tue, 25 Apr 2017 17:57:22 +0530 Vibhav Pant wrote: >> Finally, maybe we could also consider using the existing facility >> :print-function (the manual says that's currently unused). But I don't >> know the full implications of that, so maybe it's a bad suggestion. VP> Wouldn't that restrict encoding only to JSON?, I think passing all VP> (json) encoding through json.el would be a better design. Yeah, it's not a great suggestion :) Thanks for all the work. Ted