emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

JSON->lisp Mapping: Hash vs AList


From: raman
Subject: JSON->lisp Mapping: Hash vs AList
Date: Mon, 11 Dec 2017 17:39:42 -0800

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 


-- 

-- 

-- 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]