From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Philipp Stephani Newsgroups: gmane.emacs.devel Subject: Re: JSON->lisp Mapping: Hash vs AList Date: Wed, 13 Dec 2017 22:37:46 +0000 Message-ID: References: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="001a11c012764a97c00560406be0" X-Trace: blaine.gmane.org 1513204726 15951 195.159.176.226 (13 Dec 2017 22:38:46 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 13 Dec 2017 22:38:46 +0000 (UTC) Cc: emacs-devel@gnu.org To: raman Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Dec 13 23:38:41 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 1ePFfk-0003nS-8e for ged-emacs-devel@m.gmane.org; Wed, 13 Dec 2017 23:38:40 +0100 Original-Received: from localhost ([::1]:38084 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ePFfp-0003FT-Ol for ged-emacs-devel@m.gmane.org; Wed, 13 Dec 2017 17:38:45 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:41731) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ePFf6-0003FG-QN for emacs-devel@gnu.org; Wed, 13 Dec 2017 17:38:02 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ePFf4-00049p-TT for emacs-devel@gnu.org; Wed, 13 Dec 2017 17:38:00 -0500 Original-Received: from mail-qt0-x232.google.com ([2607:f8b0:400d:c0d::232]:43652) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ePFf4-00049D-Lm for emacs-devel@gnu.org; Wed, 13 Dec 2017 17:37:58 -0500 Original-Received: by mail-qt0-x232.google.com with SMTP id w10so5710466qtb.10 for ; Wed, 13 Dec 2017 14:37:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=7z39Dq1tk6Am2A3NbDZakjxOEl9PwWaEM+sx7Wma0/g=; b=cYUs2NanJ7QgbwBbi8gUR1D4/S4uWXFO3rFz3HlTKuaU+/MLN/aIMw5CxZdg8TLl+J zhefI5Ng9BCt8eqstLQ9xW5lrFgFJISLiIBuPxufd1oBJejI23/reqkmLCX+pebqnWYz 9SpXSue6EdigMk/jgi9nButM96egwIJBim0cHIf8hxZXQjgbqN9sFfVpw5snga2h5uUW HNhf3HRfeStkkDGQQIKhuFQr6suJu8mAT7s7qzDaKI2sF5J18EOFM3M32wfZiZBb6JkR oRyLOUaj7s0PKLA0WeNnsr4DDzVOTraV0VtWj+KHVw2NraCJ9KXNwtH+lW1INouj8K2H ykHQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=7z39Dq1tk6Am2A3NbDZakjxOEl9PwWaEM+sx7Wma0/g=; b=n5ZGffukSBiEvD/KBpmscJFfUhwNW24Kax116vslStKpBt902zJuFVmxxYtJeFmWQT 8DOn+8CTt65bdEUerzZxAlR+77zMR3OtEYZCgzxlnNQq327/xYgAPJ2CNnzxkmZ/cyC/ X/E6tSKyUchk4o1MU47KapY/Pej+PzBworaKk3v9XwP5XwikWHImRogb7ciF+lpuw4hI Vje5jaGZMLkK1FemvlgT+9clRXpYOcvpzThMKR7wXsaMWeZ2TklB/Ts5+VFBEC62RmDS or9lkAnVF/4rEOhXlUQp4eDos8FHc90JSrO01yyW/bP7wz811B6NDyqW5fDzAUJbSK2J k7RA== X-Gm-Message-State: AKGB3mLzwseZ4r6qLVhmrlPpp3obU3kcH7zFh+ZhiiKPyLpazKsRE2Ge Cyp0mb0nvjRiUkld656vCTQk/G/qV5VLIoHEG/8= X-Google-Smtp-Source: ACJfBovwVGFjUJG8HdQCtPUkjhaRSMdpUjxU5Z0/sxM/Po4at8RZRt4gr5KLGzfR0rBFNy628EYR8jjPTauA1cAmr6g= X-Received: by 10.200.46.149 with SMTP id h21mr13024914qta.73.1513204677768; Wed, 13 Dec 2017 14:37:57 -0800 (PST) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400d:c0d::232 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:221030 Archived-At: --001a11c012764a97c00560406be0 Content-Type: multipart/alternative; boundary="001a11c012764a97bc0560406bde" --001a11c012764a97bc0560406bde Content-Type: text/plain; charset="UTF-8" raman schrieb am Di., 12. Dez. 2017 um 02:40 Uhr: > Build Emacs from @Head and started playing with the native > implementation of JSON parsing -- it works well and is much faster > than the lisp version as expected. > > After writing some code with it, I have a feature request --- could we > set it up so that the caller can specify that json-hashes map to lisp > alists -- rather than lisp hash-tables? > Sounds reasonable, here is a patch. --001a11c012764a97bc0560406bde Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


raman = <raman@google.com> schrieb am= Di., 12. Dez. 2017 um 02:40=C2=A0Uhr:
Build Emacs from @Head and started playing with the native
implementation of JSON parsing -- it works well and is much faster
than the lisp version as expected.

After writing some code with it, I have a feature request --- could we
set it up so that the caller can specify that json-hashes map to lisp
alists -- rather than lisp hash-tables?

Sounds reasonable, here is a patch.=C2=A0<= /div>
--001a11c012764a97bc0560406bde-- --001a11c012764a97c00560406be0 Content-Type: text/plain; charset="UTF-8"; name="0001-Allow-JSON-parser-functions-to-return-alists.txt" Content-Disposition: attachment; filename="0001-Allow-JSON-parser-functions-to-return-alists.txt" Content-Transfer-Encoding: base64 Content-ID: <1605206b6bb581411ec1> X-Attachment-Id: 1605206b6bb581411ec1 RnJvbSBlYjExNjI4OTNmYWRkOTI4YTg5M2E3OWZlMGRkZWFmODI3ZTVkZmM1IE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQpGcm9tOiBQaGlsaXBwIFN0ZXBoYW5pIDxwaHN0QGdvb2dsZS5jb20+CkRh dGU6IFdlZCwgMTMgRGVjIDIwMTcgMjM6MzU6MDcgKzAxMDAKU3ViamVjdDogW1BBVENIXSBBbGxv dyBKU09OIHBhcnNlciBmdW5jdGlvbnMgdG8gcmV0dXJuIGFsaXN0cwoKKiBzcmMvanNvbi5jIChG anNvbl9wYXJzZV9zdHJpbmcsIEZqc29uX3BhcnNlX2J1ZmZlcik6IEdpdmUgdGhlc2UKZnVuY3Rp b25zIGEga2V5d29yZCBhcmd1bWVudCB0byBzcGVjaWZ5IHRoZSByZXR1cm4gdHlwZSBmb3IgSlNP TgpvYmplY3RzLgooanNvbl90b19saXNwKTogQ29udmVydCBvYmplY3RzIHRvIGFsaXN0cyBpZiBy ZXF1ZXN0ZWQuCihqc29uX3BhcnNlX29iamVjdF90eXBlKTogTmV3IGhlbHBlciBmdW5jdGlvbiB0 byBwYXJzZSBrZXl3b3JkCmFyZ3VtZW50cy4KCiogdGVzdC9zcmMvanNvbi10ZXN0cy5lbCAoanNv bi1wYXJzZS1zdHJpbmcvb2JqZWN0KTogQWRkIGEgdW5pdCB0ZXN0LgoKKiBkb2MvbGlzcHJlZi90 ZXh0LnRleGkgKFBhcnNpbmcgSlNPTik6IERvY3VtZW50IG5ldyBmdW5jdGlvbmFsaXR5LgotLS0K IGRvYy9saXNwcmVmL3RleHQudGV4aSAgfCAgMjAgKysrKy0tLS0KIHNyYy9qc29uLmMgICAgICAg ICAgICAgfCAxM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fdHlwZSB7CisgIGpzb25fb2JqZWN0X2hhc2h0 YWJsZSwKKyAganNvbl9vYmplY3RfYWxpc3QsCit9OworCiAvKiBDb252ZXJ0IGEgSlNPTiBvYmpl Y3QgdG8gYSBMaXNwIG9iamVjdC4gICovCiAKIHN0YXRpYyBfR0xfQVJHX05PTk5VTEwgKCgxKSkg TGlzcF9PYmplY3QKLWpzb25fdG9fbGlzcCAoanNvbl90ICpqc29uKQoranNvbl90b19saXNwIChq c29uX3QgKmpzb24sIGVudW0ganNvbl9vYmplY3RfdHlwZSBvYmplY3RfdHlwZSkKIHsKICAgc3dp dGNoIChqc29uX3R5cGVvZiAoanNvbikpCiAgICAgewpAQCAtNTQ0LDcgKzU0OSw3IEBAIGpzb25f dG9fbGlzcCAoanNvbl90ICpqc29uKQogICAgICAgICBMaXNwX09iamVjdCByZXN1bHQgPSBGbWFr ZV92ZWN0b3IgKG1ha2VfbmF0bnVtIChzaXplKSwgUXVuYm91bmQpOwogICAgICAgICBmb3IgKHB0 cmRpZmZfdCBpID0gMDsgaSA8IHNpemU7ICsraSkKICAgICAgICAgICBBU0VUIChyZXN1bHQsIGks Ci0gICAgICAgICAgICAgICAganNvbl90b19saXNwIChqc29uX2FycmF5X2dldCAoanNvbiwgaSkp KTsKKyAgICAgICAgICAgICAgICBqc29uX3RvX2xpc3AgKGpzb25fYXJyYXlfZ2V0IChqc29uLCBp KSwgb2JqZWN0X3R5cGUpKTsKICAgICAgICAgLS1saXNwX2V2YWxfZGVwdGg7CiAgICAgICAgIHJl dHVybiByZXN1bHQ7CiAgICAgICB9CkBAIC01NTIsMjMgKzU1Nyw0OSBAQCBqc29uX3RvX2xpc3Ag KGpzb25fdCAqanNvbikKICAgICAgIHsKICAgICAgICAgaWYgKCsrbGlzcF9ldmFsX2RlcHRoID4g bWF4X2xpc3BfZXZhbF9kZXB0aCkKICAgICAgICAgICB4c2lnbmFsMCAoUWpzb25fb2JqZWN0X3Rv b19kZWVwKTsKLSAgICAgICAgc2l6ZV90IHNpemUgPSBqc29uX29iamVjdF9zaXplIChqc29uKTsK LSAgICAgICAgaWYgKEZJWE5VTV9PVkVSRkxPV19QIChzaXplKSkKLSAgICAgICAgICB4c2lnbmFs MCAoUW92ZXJmbG93X2Vycm9yKTsKLSAgICAgICAgTGlzcF9PYmplY3QgcmVzdWx0ID0gQ0FMTE4g KEZtYWtlX2hhc2hfdGFibGUsIFFDdGVzdCwgUWVxdWFsLAotICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgUUNzaXplLCBtYWtlX25hdG51bSAoc2l6ZSkpOwotICAgICAgICBzdHJ1 Y3QgTGlzcF9IYXNoX1RhYmxlICpoID0gWEhBU0hfVEFCTEUgKHJlc3VsdCk7Ci0gICAgICAgIGNv bnN0IGNoYXIgKmtleV9zdHI7Ci0gICAgICAgIGpzb25fdCAqdmFsdWU7Ci0gICAgICAgIGpzb25f b2JqZWN0X2ZvcmVhY2ggKGpzb24sIGtleV9zdHIsIHZhbHVlKQorICAgICAgICBMaXNwX09iamVj dCByZXN1bHQ7CisgICAgICAgIHN3aXRjaCAob2JqZWN0X3R5cGUpCiAgICAgICAgICAgewotICAg ICAgICAgICAgTGlzcF9PYmplY3Qga2V5ID0ganNvbl9idWlsZF9zdHJpbmcgKGtleV9zdHIpOwot ICAgICAgICAgICAgRU1BQ1NfVUlOVCBoYXNoOwotICAgICAgICAgICAgcHRyZGlmZl90IGkgPSBo YXNoX2xvb2t1cCAoaCwga2V5LCAmaGFzaCk7Ci0gICAgICAgICAgICAvKiBLZXlzIGluIEpTT04g b2JqZWN0cyBhcmUgdW5pcXVlLCBzbyB0aGUga2V5IGNhbuKAmXQgYmUKLSAgICAgICAgICAgICAg IHByZXNlbnQgeWV0LiAgKi8KLSAgICAgICAgICAgIGVhc3NlcnQgKGkgPCAwKTsKLSAgICAgICAg ICAgIGhhc2hfcHV0IChoLCBrZXksIGpzb25fdG9fbGlzcCAodmFsdWUpLCBoYXNoKTsKKyAgICAg ICAgICBjYXNlIGpzb25fb2JqZWN0X2hhc2h0YWJsZToKKyAgICAgICAgICAgIHsKKyAgICAgICAg ICAgICAgc2l6ZV90IHNpemUgPSBqc29uX29iamVjdF9zaXplIChqc29uKTsKKyAgICAgICAgICAg ICAgaWYgKEZJWE5VTV9PVkVSRkxPV19QIChzaXplKSkKKyAgICAgICAgICAgICAgICB4c2lnbmFs MCAoUW92ZXJmbG93X2Vycm9yKTsKKyAgICAgICAgICAgICAgcmVzdWx0ID0gQ0FMTE4gKEZtYWtl X2hhc2hfdGFibGUsIFFDdGVzdCwgUWVxdWFsLCBRQ3NpemUsCisgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICBtYWtlX25hdG51bSAoc2l6ZSkpOworICAgICAgICAgICAgICBzdHJ1Y3QgTGlz cF9IYXNoX1RhYmxlICpoID0gWEhBU0hfVEFCTEUgKHJlc3VsdCk7CisgICAgICAgICAgICAgIGNv bnN0IGNoYXIgKmtleV9zdHI7CisgICAgICAgICAgICAgIGpzb25fdCAqdmFsdWU7CisgICAgICAg ICAgICAgIGpzb25fb2JqZWN0X2ZvcmVhY2ggKGpzb24sIGtleV9zdHIsIHZhbHVlKQorICAgICAg ICAgICAgICAgIHsKKyAgICAgICAgICAgICAgICAgIExpc3BfT2JqZWN0IGtleSA9IGpzb25fYnVp bGRfc3RyaW5nIChrZXlfc3RyKTsKKyAgICAgICAgICAgICAgICAgIEVNQUNTX1VJTlQgaGFzaDsK KyAgICAgICAgICAgICAgICAgIHB0cmRpZmZfdCBpID0gaGFzaF9sb29rdXAgKGgsIGtleSwgJmhh c2gpOworICAgICAgICAgICAgICAgICAgLyogS2V5cyBpbiBKU09OIG9iamVjdHMgYXJlIHVuaXF1 ZSwgc28gdGhlIGtleSBjYW7igJl0CisgICAgICAgICAgICAgICAgICAgICBiZSBwcmVzZW50IHll dC4gICovCisgICAgICAgICAgICAgICAgICBlYXNzZXJ0IChpIDwgMCk7CisgICAgICAgICAgICAg ICAgICBoYXNoX3B1dCAoaCwga2V5LCBqc29uX3RvX2xpc3AgKHZhbHVlLCBvYmplY3RfdHlwZSks IGhhc2gpOworICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgYnJlYWs7CisgICAgICAg ICAgICB9CisgICAgICAgICAgY2FzZSBqc29uX29iamVjdF9hbGlzdDoKKyAgICAgICAgICAgIHsK KyAgICAgICAgICAgICAgcmVzdWx0ID0gUW5pbDsKKyAgICAgICAgICAgICAgY29uc3QgY2hhciAq a2V5X3N0cjsKKyAgICAgICAgICAgICAganNvbl90ICp2YWx1ZTsKKyAgICAgICAgICAgICAganNv bl9vYmplY3RfZm9yZWFjaCAoanNvbiwga2V5X3N0ciwgdmFsdWUpCisgICAgICAgICAgICAgICAg eworICAgICAgICAgICAgICAgICAgTGlzcF9PYmplY3Qga2V5ID0gRmludGVybiAoanNvbl9idWls ZF9zdHJpbmcgKGtleV9zdHIpLCBRbmlsKTsKKyAgICAgICAgICAgICAgICAgIHJlc3VsdAorICAg ICAgICAgICAgICAgICAgICA9IEZjb25zIChGY29ucyAoa2V5LCBqc29uX3RvX2xpc3AgKHZhbHVl LCBvYmplY3RfdHlwZSkpLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXN1bHQpOwor ICAgICAgICAgICAgICAgIH0KKyAgICAgICAgICAgICAgcmVzdWx0ID0gRm5yZXZlcnNlIChyZXN1 bHQpOworICAgICAgICAgICAgICBicmVhazsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICBkZWZh dWx0OgorICAgICAgICAgICAgLyogQ2Fu4oCZdCBnZXQgaGVyZS4gICovCisgICAgICAgICAgICBl bWFjc19hYm9ydCAoKTsKICAgICAgICAgICB9CiAgICAgICAgIC0tbGlzcF9ldmFsX2RlcHRoOwog ICAgICAgICByZXR1cm4gcmVzdWx0OwpAQCAtNTc4LDE1ICs2MDksNDMgQEAganNvbl90b19saXNw IChqc29uX3QgKmpzb24pCiAgIGVtYWNzX2Fib3J0ICgpOwogfQogCi1ERUZVTiAoImpzb24tcGFy c2Utc3RyaW5nIiwgRmpzb25fcGFyc2Vfc3RyaW5nLCBTanNvbl9wYXJzZV9zdHJpbmcsIDEsIDEs IE5VTEwsCitzdGF0aWMgZW51bSBqc29uX29iamVjdF90eXBlCitqc29uX3BhcnNlX29iamVjdF90 eXBlIChwdHJkaWZmX3QgbmFyZ3MsIExpc3BfT2JqZWN0ICphcmdzKQoreworICBzd2l0Y2ggKG5h cmdzKQorICAgIHsKKyAgICBjYXNlIDA6CisgICAgICByZXR1cm4ganNvbl9vYmplY3RfaGFzaHRh YmxlOworICAgIGNhc2UgMjogeworICAgICAgTGlzcF9PYmplY3Qga2V5ID0gYXJnc1swXTsKKyAg ICAgIExpc3BfT2JqZWN0IHZhbHVlID0gYXJnc1sxXTsKKyAgICAgIGlmICghRVEgKGtleSwgUUNv YmplY3RfdHlwZSkpCisgICAgICAgIHdyb25nX2Nob2ljZSAobGlzdDEgKFFDb2JqZWN0X3R5cGUp LCBrZXkpOworICAgICAgaWYgKEVRICh2YWx1ZSwgUWhhc2hfdGFibGUpKQorICAgICAgICByZXR1 cm4ganNvbl9vYmplY3RfaGFzaHRhYmxlOworICAgICAgZWxzZSBpZiAoRVEgKHZhbHVlLCBRYWxp c3QpKQorICAgICAgICByZXR1cm4ganNvbl9vYmplY3RfYWxpc3Q7CisgICAgICBlbHNlCisgICAg ICAgIHdyb25nX2Nob2ljZSAobGlzdDIgKFFoYXNoX3RhYmxlLCBRYWxpc3QpLCB2YWx1ZSk7Cisg ICAgfQorICAgIGRlZmF1bHQ6CisgICAgICB3cm9uZ190eXBlX2FyZ3VtZW50IChRcGxpc3RwLCBG bGlzdCAobmFyZ3MsIGFyZ3MpKTsKKyAgICB9Cit9CisKK0RFRlVOICgianNvbi1wYXJzZS1zdHJp bmciLCBGanNvbl9wYXJzZV9zdHJpbmcsIFNqc29uX3BhcnNlX3N0cmluZywgMSwgTUFOWSwKKyAg ICAgICBOVUxMLAogICAgICAgIGRvYzogLyogUGFyc2UgdGhlIE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UtY291bnQgYWN0dWFsKSAyKSkK KyAgICAgIChzaG91bGQgKGVxdWFsIChjbC1zb3J0IChtYXAtcGFpcnMgYWN0dWFsKSAjJ3N0cmlu ZzwgOmtleSAjJ2NhcikKKyAgICAgICAgICAgICAgICAgICAgICcoKCJhYmMiIC4gWzkgOmZhbHNl XSkgKCJkZWYiIC4gOm51bGwpKSkpKQorICAgIChzaG91bGQgKGVxdWFsIChqc29uLXBhcnNlLXN0 cmluZyBpbnB1dCA6b2JqZWN0LXR5cGUgJ2FsaXN0KQorICAgICAgICAgICAgICAgICAgICcoKGFi YyAuIFs5IDpmYWxzZV0pIChkZWYgLiA6bnVsbCkpKSkpKQogCiAoZXJ0LWRlZnRlc3QganNvbi1w YXJzZS1zdHJpbmcvc3RyaW5nICgpCiAgIChza2lwLXVubGVzcyAoZmJvdW5kcCAnanNvbi1wYXJz ZS1zdHJpbmcpKQotLSAKMi4xNS4xCgo= --001a11c012764a97c00560406be0--