From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: raman Newsgroups: gmane.emacs.devel Subject: JSON->lisp Mapping: Hash vs AList Date: Mon, 11 Dec 2017 17:39:42 -0800 Message-ID: NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1513042869 29828 195.159.176.226 (12 Dec 2017 01:41:09 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 12 Dec 2017 01:41:09 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Dec 12 02:41:02 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 1eOZZ5-0007GJ-1u for ged-emacs-devel@m.gmane.org; Tue, 12 Dec 2017 02:40:59 +0100 Original-Received: from localhost ([::1]:56301 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eOZZC-0001Af-Co for ged-emacs-devel@m.gmane.org; Mon, 11 Dec 2017 20:41:06 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:32909) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eOZYF-00019B-V8 for emacs-devel@gnu.org; Mon, 11 Dec 2017 20:40:09 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eOZYC-0005tr-1z for emacs-devel@gnu.org; Mon, 11 Dec 2017 20:40:08 -0500 Original-Received: from mail-pf0-x233.google.com ([2607:f8b0:400e:c00::233]:42571) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eOZYB-0005tC-RU for emacs-devel@gnu.org; Mon, 11 Dec 2017 20:40:03 -0500 Original-Received: by mail-pf0-x233.google.com with SMTP id d23so12979516pfe.9 for ; Mon, 11 Dec 2017 17:40:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:message-id:from:to:subject; bh=WQQo9HNNGOIK2bUrwH57mOBzRcIKX6JHKjyYQY/6Sjw=; b=S23WfWOchRbmDjzETVpA2VQB7I9TGhKN/BHMod9uAbigWw96Om42cfaDWp82vcGJwJ nWtmev1+qLYP8uivok4yCnTxbz6vOG2W063J/vtLvQNnQeCY77iubOe8bs2f6aPy5XdP pJPy8ZYtWBFA/Tsy+gSzqKuBekeqtKd/9hPX5G7sDB82H2u6wnBqRN0OFioCL5YQxaO+ pg6KIgVCns9lJaARdwNqiN6rY+yCZX6dyElawGDk0u4OU4EQmciNos8tmvBibClP8Hz9 /XI4KA+fpHihZHlMjSGJvPuV8SZ22BvEtGStBg9NgVOj3/kHcQnsmvOITBZ2pIogt9fs XPww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:message-id:from:to:subject; bh=WQQo9HNNGOIK2bUrwH57mOBzRcIKX6JHKjyYQY/6Sjw=; b=mF9o9vZFYkp/T9Tl/H1yE+e0OjPvOZIrKCbpThMImkN5T7YiTeFEEb5dc37de/gCvZ 1xPAkUuLv1tZw4Ryky+I7NAdW9Vvf21yG1LRA6O9o8hUDD1Eu4Y7nc40z5vVs8NFUgAt 9Wnb/qfOFqLRkX8f55W92ssJ/3lu35J7ejj4K6M+lrrFZslNZdiV74kH3HgXtF7GV+3J xBldJ9YMftjzU7c9OxNokEug4bp9IBBFf1aICuaUbHbRjBNs20YyGNex607pGBamP7+z luhrFYAeBtZtx9brwlIkCu05iHgkwWMiVqahSxiYuCwCjmkaC8GCoCjhb7DSMgs1sFlt Tg3Q== X-Gm-Message-State: AKGB3mKxAb1BuO7n3O4iv7XHtlDvqZpSgm6fN3j6dhSKLBSiN2hZGeJE nQeqDwYS/9kcMBqoZqQkimZ5sd9lB4k= X-Google-Smtp-Source: ACJfBou4fdEH0Zn+TyOYQGgJT0AS9IXlndTOR+LAGltjL5NEeN9PS3RYmM9iVnR366utmSACEkmunA== X-Received: by 10.84.244.12 with SMTP id g12mr527717pll.69.1513042801879; Mon, 11 Dec 2017 17:40:01 -0800 (PST) Original-Received: from raman-glaptop2 ([50.28.235.226]) by smtp.gmail.com with ESMTPSA id r11sm24389978pgf.79.2017.12.11.17.39.51 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Mon, 11 Dec 2017 17:39:56 -0800 (PST) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c00::233 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:220915 Archived-At: 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? Justification: 1. JSON dicts tend to be deeply nested -- but rarely have a large number of entries -- so lisp hash-tables may be overkill. 2. The deeply nested nature of JSON dicts makes accessing things at deeper levels require nested calls to gethash -- leads to code that is opaque. 3. JS code succinctly accesses such nested data as a.b.c --- mapping json dicts to lisp alists gives the same expressiveness when using let-alist -- for an example see http://emacspeak.blogspot.com/2017/07/data-binding-in-emacs-lisp-let-alist.html --raman -- -- --