guix-devel
[Top][All Lists]
Advanced

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

Re: 04/04: offload: Avoid using '_' as a 'match' pattern.


From: Ludovic Courtès
Subject: Re: 04/04: offload: Avoid using '_' as a 'match' pattern.
Date: Fri, 21 Apr 2017 19:24:42 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux)

Hi,

Tobias Geerinckx-Rice <address@hidden> skribis:

> On 21/04/17 17:24, Ludovic Court�s wrote:
>> commit ba97e454bfbc168098212b37881b50b4fe6e1eb2 Author: Ludovic
>> Courtès <address@hidden> Date:   Fri Apr 21 17:18:54 2017
>> +0200
>> 
>> offload: Avoid using '_' as a 'match' pattern.
>> 
>> * guix/scripts/offload.scm (host-key->type+key, machine-load) 
>> (process-request, guix-offload): Do not use '_' as a 'match'
>> pattern.
>
> Is this something that should now be avoided in general, i.e. when
> writing packages/..., or only in specific circumstances?

Only in modules that import (guix ui).

This is due to the fact that macros in Guile 2.2 match “literals”
differently: normal bindings (like ‘_’ from (guix ui)) can shadow
literals.  The ‘NEWS’ file of Guile 2.2 puts it this way:

  ** Fix literal matching for module-bound literals

  `syntax-rules' and `syntax-case' macros can take a set of "literals":
  bound or unbound keywords that the syntax matcher treats specially.
  Before, literals were always matched symbolically (by name).  Now they
  are matched by binding.  This allows literals to be reliably bound to
  values, renamed by imports or exports, et cetera.  See "Syntax-rules
  Macros" in the manual for more on literals.

In hindsight, it would have been wiser to just rename ‘_’ in (guix ui)
to something else, like ‘G_’.  Well, it’s not too late.  Should we do
that?  Thoughts?

Ludo’.



reply via email to

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