guix-devel
[Top][All Lists]
Advanced

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

Migrating to Guile-JSON 3.x


From: Ludovic Courtès
Subject: Migrating to Guile-JSON 3.x
Date: Tue, 22 Jan 2019 14:46:30 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)

Hello Guix!

As you may know, Guile-JSON 3.x, released a couple of weeks ago, makes
significant incompatible API changes, the most important of which is
this:

--8<---------------cut here---------------start------------->8---
$ guix environment --ad-hoc guile address@hidden -- guile -c '(use-modules 
(json)) (pk (json-string->scm "{ \"a\": 1, \"b\": 2 }"))'

;;; (#<hash-table 10af420 2/31>)
$ guix environment --ad-hoc guile address@hidden -- guile -c '(use-modules 
(json)) (pk (json-string->scm "{ \"a\": 1, \"b\": 2 }"))'

;;; ((("b" . 2) ("a" . 1)))
--8<---------------cut here---------------end--------------->8---

In addition, JSON lists are now vectors in Scheme:

--8<---------------cut here---------------start------------->8---
$ guix environment --ad-hoc guile address@hidden -- guile -c '(use-modules 
(json)) (pk (json-string->scm "[ 1 2 3 ]"))'

;;; ((1 2 3))
$ guix environment --ad-hoc guile address@hidden -- guile -c '(use-modules 
(json)) (pk (json-string->scm "[ 1 2 3 ]"))'

;;; (#(1 2 3))
--8<---------------cut here---------------end--------------->8---

Conclusions:

  • Migration will be tricky since we’ll have to audit all our uses.
    Most of our code that uses JSON has unit tests but some of it
    doesn’t, in particular the web interface bindings in (guix ci) and
    (guix swh).

  • We won’t be able to support both 1.x and 3.x, so it’ll be a change
    with no return.

  • Things that depend on Guix (Cuirass, GWL, hpcguix-web, etc.) will
    have to switch at the same time.

Thoughts?  Volunteers?  :-)

Thanks,
Ludo’.



reply via email to

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