From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Lars Magne Ingebrigtsen Newsgroups: gmane.emacs.devel Subject: Re: mapping data formats imported from C libraries Date: Wed, 26 Nov 2014 16:56:15 +0100 Message-ID: References: <2497111.a8jb1YoNy0@descartes> <87fvd9pho8.fsf@gmail.com> <877fyj63v8.fsf_-_@lifelogs.com> <8761e3dz55.fsf@lifelogs.com> <87wq6jcjys.fsf@lifelogs.com> <87r3wqazjb.fsf@lifelogs.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1417017426 30279 80.91.229.3 (26 Nov 2014 15:57:06 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 26 Nov 2014 15:57:06 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Nov 26 16:57:00 2014 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Xtexg-0008F7-9J for ged-emacs-devel@m.gmane.org; Wed, 26 Nov 2014 16:57:00 +0100 Original-Received: from localhost ([::1]:34495 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xtexf-0001Lo-Vs for ged-emacs-devel@m.gmane.org; Wed, 26 Nov 2014 10:56:59 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:41709) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XtexM-0001Gd-2o for emacs-devel@gnu.org; Wed, 26 Nov 2014 10:56:45 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XtexG-0000LA-Og for emacs-devel@gnu.org; Wed, 26 Nov 2014 10:56:40 -0500 Original-Received: from hermes.netfonds.no ([80.91.224.195]:36341) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XtexG-0000L3-Hs for emacs-devel@gnu.org; Wed, 26 Nov 2014 10:56:34 -0500 Original-Received: from cm-84.215.51.58.getinternet.no ([84.215.51.58] helo=stories.gnus.org) by hermes.netfonds.no with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1Xtewy-0003Dj-5s for emacs-devel@gnu.org; Wed, 26 Nov 2014 16:56:16 +0100 Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAD1BMVEULBQSXlJAUDgwZFBIQ CQjOUiIRAAACRklEQVQ4jU1UiZHjMAzDOWrA8RbgJVXAhnQBOpr913SgnFtHM5mJBAkAP6NnqvWm bmGhfnCXovuCSHUxFxUZQgCy6N6QyOQx11gC4HV05AAaOgFRPYQvBm+NOh0EUnqO0OEqIR1YuOUT gVN9LJKHgDu0EDWLEFgPo1KIoRZPwkoVh548UuE7Gjl3NOnlFJ2GapOoWJboe+QZrgi30UI7Scw6 WpKfsSoYQs/oudBv7Fh2dTXpRoA0kiKJfnZxJ+B7HwXIa33awGP9vzwzUEzr+jVanjfAXMwXBYjp LxAn7ZKUwEa9m6oxOxAXUm00elPRpjOJkwrRF5/rRY1DCDBeApVYZkx/8GddT6NGyKRivh7u1od8 r6swHPgxCmAtqEFASZWddpNVJ5DuE8j8SyCy6rxjZeRRLw7mfgJlt49G8YQwwENGUsOYcvzgipz2 eMKifldKVMFG6gWMURr0VXE442ApBjUyK3IargBVaTePyu6TBv03JVrNwFhItdXdG+AGeVZKtsrS B1Av2NMXcNeDJSrAZj3040W1PzgAs9vN72VSuYqqMHvq4/ii4t3Nn28Bf22vTcnuIDc1Xuu2bttG mW1GTlfmx6PCdePP68obcNsfH7pFTz+zgonzOtL3+bQI2VuL+s9B0onqvAbWic1h53n5Z+biAmqc Od7Rsnh4fzLWRPXcOTeZ6XIhWryOXWvMEHPLUZriJAHnnT3B0TkvR/I2XQCycSJDL6t1Wp1YwEDN jfsxnQr7jWmvNRq/HfwcTQHrZUX+AbLJrp6WXGW3AAAAAElFTkSuQmCC X-Now-Playing: Various's _Hyperdub 10_: "Cooly G - Mind" X-Hashcash: 1:23:141126:emacs-devel@gnu.org::kCUo4bLtD68oeuTN:000000000000000000000000000000000000000000FTi6 In-Reply-To: <87r3wqazjb.fsf@lifelogs.com> (Ted Zlatanov's message of "Wed, 26 Nov 2014 07:59:04 -0500") User-Agent: Gnus/5.130012 (Ma Gnus v0.12) Emacs/25.0.50 (gnu/linux) X-MailScanner-ID: 1Xtewy-0003Dj-5s MailScanner-NULL-Check: 1417622176.39365@HI8/MbxdLarWxxgem00LJA X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.224.195 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 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-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:178304 Archived-At: Ted Zlatanov writes: > Yeah, I've seen the mess that libxml2 and json.el produce (not the > coder's fault, it's just a pain to adapt without native types). It > doesn't help that XML/SGML and Lisp are inbred cousins :) > > * it's a pain to distinguish JSON's `false' and `null' while using them > in code Well, I don't think that's a DOM point. > * in json.el you pick the key-value storage method! yay! > > * in json.el you pick the array storage method! yay! > > * JSON data is not a tree Sure it is. {"a": {"b": [1, 2], "c": 4}} > My ideal mapping from libjson and libyaml would be: > > * unambiguous: you can reconstruct a canonical version of the input > stream from the parse data, as much as possible (JSON is better at this) Trivial from the Emacs DOM. > * native: you can iterate over JSON arrays as Lisp lists, and JSON > key-value mappings as alists. JSON's `false' and `null' are both > false in Lisp boolean context. Outside the scope of the DOM. > * clean: no extra cons cells for attributes Doesn't matter. :-) > * readable: this is huge IMO, to be able to pretty-print the data and > quickly see what it contains... one of the things I like about JSON > vs. SGML/XML. `pp' prints the DOM real purdy like. I've web scraped bunches and bunches of pages, and reading the DOM in the *scratch* buffer is really easy. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no