all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Re: 02/02: import: cpan: Adapt for the change to guile-json version 3.
       [not found] ` <20190821172956.6533A20E34@vcs0.savannah.gnu.org>
@ 2019-08-21 20:06   ` Mark H Weaver
  2019-08-22  7:41     ` Christopher Baines
  0 siblings, 1 reply; 4+ messages in thread
From: Mark H Weaver @ 2019-08-21 20:06 UTC (permalink / raw)
  To: Christopher Baines; +Cc: guix-devel

Hi Christopher,

guix-commits@gnu.org writes:

> cbaines pushed a commit to branch master
> in repository guix.
>
> commit 01ce7af25add55514f737af48ea6c127bedfde67
> Author: Christopher Baines <mail@cbaines.net>
> 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)?

      Thanks,
        Mark

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: 02/02: import: cpan: Adapt for the change to guile-json version 3.
  2019-08-21 20:06   ` 02/02: import: cpan: Adapt for the change to guile-json version 3 Mark H Weaver
@ 2019-08-22  7:41     ` Christopher Baines
  2019-08-22  7:59       ` Ricardo Wurmus
  0 siblings, 1 reply; 4+ messages in thread
From: Christopher Baines @ 2019-08-22  7:41 UTC (permalink / raw)
  To: Mark H Weaver; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 2682 bytes --]


Mark H Weaver <mhw@netris.org> writes:

> Hi Christopher,
>
> guix-commits@gnu.org writes:
>
>> cbaines pushed a commit to branch master
>> in repository guix.
>>
>> commit 01ce7af25add55514f737af48ea6c127bedfde67
>> Author: Christopher Baines <mail@cbaines.net>
>> 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 #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 962 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: 02/02: import: cpan: Adapt for the change to guile-json version 3.
  2019-08-22  7:41     ` Christopher Baines
@ 2019-08-22  7:59       ` Ricardo Wurmus
  2019-08-22 18:32         ` Mark H Weaver
  0 siblings, 1 reply; 4+ messages in thread
From: Ricardo Wurmus @ 2019-08-22  7:59 UTC (permalink / raw)
  To: Christopher Baines; +Cc: guix-devel


Hi,

> Mark H Weaver <mhw@netris.org> writes:
[…]
>> 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.

The problem is with the “guix” package, which used to give you an
environment containing guile-json@1.  This was changed in commit
2eb0628a423a36bc21777d7439885baa9a9a8e6d.  (If that’s not the culprit
perhaps it’s an old version of Guile JSON in your profile?)

Do “guix environment guix --ad-hoc guile-json” in the meantime.

> 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).

Yes, the changes should be reverted.

--
Ricardo

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: 02/02: import: cpan: Adapt for the change to guile-json version 3.
  2019-08-22  7:59       ` Ricardo Wurmus
@ 2019-08-22 18:32         ` Mark H Weaver
  0 siblings, 0 replies; 4+ messages in thread
From: Mark H Weaver @ 2019-08-22 18:32 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: guix-devel

Ricardo Wurmus <rekado@elephly.net> writes:

>> 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).
>
> Yes, the changes should be reverted.

Done in commits d020821c0bd2206a5f3d4db155f2a9a3de7dc670 and
888e477bf82452028fb188ec94e793bd04f98d55 on 'master'.

Thanks for the quick responses!  I also ran into difficulties recently
setting up a suitable build environment for my Guix git checkout after
the change to guile-json 3.  I wasn't sure if it affected anyone else,
since I do things a bit oddly, always running Guix from a git checkout,
and never running 'guix pull'.

      Regards,
        Mark

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-08-22 18:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20190821172955.31209.69550@vcs0.savannah.gnu.org>
     [not found] ` <20190821172956.6533A20E34@vcs0.savannah.gnu.org>
2019-08-21 20:06   ` 02/02: import: cpan: Adapt for the change to guile-json version 3 Mark H Weaver
2019-08-22  7:41     ` Christopher Baines
2019-08-22  7:59       ` Ricardo Wurmus
2019-08-22 18:32         ` Mark H Weaver

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.