From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: rain1@airmail.cc Newsgroups: gmane.lisp.guile.user Subject: Re: guile-json 2.0.0 released Date: Wed, 19 Dec 2018 19:17:45 +0000 Message-ID: References: <87y38meqbo.fsf@gnu.org> <87lg4lzt9l.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1545247783 3511 195.159.176.226 (19 Dec 2018 19:29:43 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 19 Dec 2018 19:29:43 +0000 (UTC) User-Agent: Roundcube Webmail/1.3.6 Cc: guile-user@gnu.org To: =?UTF-8?Q?Aleix_Conchillo_Flaqu=C3=A9?= Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Wed Dec 19 20:29:39 2018 Return-path: Envelope-to: guile-user@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 1gZhXH-0000lM-33 for guile-user@m.gmane.org; Wed, 19 Dec 2018 20:29:39 +0100 Original-Received: from localhost ([::1]:33807 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZhZN-0003y2-DT for guile-user@m.gmane.org; Wed, 19 Dec 2018 14:31:49 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:45534) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZhLu-0001NX-Lm for guile-user@gnu.org; Wed, 19 Dec 2018 14:17:57 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZhLq-0000OM-0q for guile-user@gnu.org; Wed, 19 Dec 2018 14:17:54 -0500 Original-Received: from cock.li ([185.100.85.212]:33138) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gZhLp-0000Ik-JK for guile-user@gnu.org; Wed, 19 Dec 2018 14:17:49 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=airmail.cc; s=mail; t=1545247065; bh=w7HSe9NxK8Fz6i3lJCcY5v5QgnDEVVPqw3hkzyeG56k=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=sxNT/cIvW2eskkohM1/MI/LX3u6HC64RMvGznSSRo8/FsDr+vJClg1w4O7kAhfV0J FqvWfK1G+eOMd9V2tyOsprWF+NwALRYpfyTXboGbboumdgSDi7Griod0wTSJqrcpUo d4H/JHRpbZXFriBFSN7UQseiVkNRhrs+7Y9imeHEm7T717IN8CEBNzzqI0iPal4dlE Syj3KJIbObMW3veiF2xlCeY/VeGiBxtAHFdIq4c6WiT8hNfYiQf2tNUyuE9Ubs9PxK lueAGcuz1MMQ9ZcE+4GuaiJyFMziFXRmxGwaQ8tR+2pX2ZUvcJITy5LxUa6cMsDAGw wRocMmx+pUXuA== In-Reply-To: X-Sender: rain1@airmail.cc X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 185.100.85.212 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Original-Sender: "guile-user" Xref: news.gmane.org gmane.lisp.guile.user:15131 Archived-At: On 2018-12-19 18:14, Aleix Conchillo Flaqu=C3=A9 wrote: > On Wed, Dec 19, 2018 at 2:48 AM Ludovic Court=C3=A8s wro= te: >>=20 >> Hi Aleix, >>=20 >> Aleix Conchillo Flaqu=C3=A9 skribis: >>=20 >> > Any comments on the discussion between alist/vector vs >> > hash-tables/list? How hard would it be for Guix to change to the >> > alist/vector approach? I'm just considering options and would like >> > input from anyone who uses guile-json, specially Guix who's probably >> > the biggest user. >>=20 >> I sympathize with David=E2=80=99s comments and would have been happy k= eeping=20 >> the >> ability to pass alists as inputs. :-) >>=20 >=20 > Yes, me too. The problem was that guile-json was broken, since there > was no way to distinguish json arrays (lists) from json objects > (alists) and the code that guile-json had was doing the wrong thing. >=20 >> I haven=E2=80=99t checked but IIUC quite a bit of code in Guix would h= ave to=20 >> be >> modified to use =E2=80=98alist->hash-table=E2=80=99. >>=20 >> As for vectors vs. lists, I suppose Scheme vectors in theory=20 >> correspond >> directly to JS arrays (O(1) access), so that=E2=80=99d be an argument = in favor >> of using vectors on the Scheme side. However vectors in Scheme are=20 >> less >> convenient than lists, as John noted, and I=E2=80=99m guessing that of= ten=20 >> lists >> are good enough. Tricky! >>=20 >=20 > My guess is that most of the time people build objects with JSON so it > seems logic to map them to the most convenient way to represent that > in Scheme which would be alists. >=20 > So, I'm really considering switching to alists for objects and vectors > for arrays. >=20 > Thanks! >=20 > Aleix Yes scheme arrays <-> json arrays scheme alists <-> json objects seems like a good choice. it is a bijection, nothing clashes or overlaps=20 and everything has a literal syntax. It will mean we have to use vector-ref/vector-map instead of car/map and=20 stuff, but I think that's fine.