guix-devel
[Top][All Lists]
Advanced

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

Re: 02/02: import: cpan: Adapt for the change to guile-json version 3.


From: Christopher Baines
Subject: Re: 02/02: import: cpan: Adapt for the change to guile-json version 3.
Date: Thu, 22 Aug 2019 08:41:11 +0100
User-agent: mu4e 1.2.0; emacs 26.2

Mark H Weaver <address@hidden> writes:

> Hi Christopher,
>
> address@hidden writes:
>
>> cbaines pushed a commit to branch master
>> in repository guix.
>>
>> commit 01ce7af25add55514f737af48ea6c127bedfde67
>> Author: Christopher Baines <address@hidden>
>> Date:   Tue Aug 6 20:17:28 2019 +0100
>>
>>     import: cpan: Adapt for the change to guile-json version 3.
>>
>>     In guile-json version 3, JSON objects are represented as hash tables, 
>> rather
>>     than alists.
>
> I haven't looked carefully, but I thought it was the other way around.
> Quoting from the guile-json 3.0.0 release announcement:
>
>   "JSON objects are now defined as alists (instead of hash tables) and
>   JSON arrays are now defined as vectors (instead of lists)."
>
>   <https://savannah.nongnu.org/forum/forum.php?forum_id=9340>
>
> With this in mind, I'm surprised to see additional uses of hash tables
> here.  It would be good to avoid hash tables except in cases where
> efficiency demands it.
>
>>     * guix/import/cpan.scm (string->license): Change the match expression to 
>> match
>>     on lists, rather than vectors.
>>     (module->dist-name, cpan-source-url, cpan-version): Change assoc-ref to
>>     hash-ref.
>>     (cpan-module->sexp): Change assoc-ref to hash-ref, and assoc-ref* to
>>     hash-ref*.
>>     * tests/cpan.scm ("source-url-http", "source-url-https"): Convert the 
>> alist to
>>     a hash table.
>
> Can you help me understand why the apparent switch _away_ from hash
> tables in Guile-JSON-3 has somehow led to increased usage of hash tables
> in this commit, as well as the addition of 'hash-ref*' in the exports of
> (guix import utils)?

I think the answer is somehow I'm still using an earlier version of
Guile JSON.

→ ./pre-inst-env guile -c '(begin (use-modules (json)) (display 
(json-string->scm "{\"foo\": 1}")))'
#<hash-table b3dd40 1/31>

When I run configure, that seems happy with the version of Guile JSON.

  checking whether Guile-JSON is available and recent enough... yes

However, I'm running ./configure in guix environment guix, and yeah,
that seems to provide a different version of guile-json to the one that
I apparently have implicitly in my profile.

So maybe it's not enough to run ./pre-inst-env, I need to do that within
guix environment guix to make it more likely that I get a profile that
works...

Back to these changes though, all I wanted to do was to fix the
importer, but if the problem is with my environment not the Guix code,
then these changes probably need reverting (as they'll break the
importer who's not got a similarly broken local setup).

Chris

Attachment: signature.asc
Description: PGP signature


reply via email to

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