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

2017-05-03 Thread Ludovic Courtès
Mark H Weaver  skribis:

> l...@gnu.org (Ludovic Courtès) writes:
>> 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?
>
> I agree that renaming '_' in (guix ui) is the better approach.

Done in 69daee23af49aeafcb1d250c90860f9253da719e.

The downside is that I had to disable -Wformat, which reported too many
“non-literal format string”: -Wformat assumes that the ‘gettext’
procedure can be called ‘_’, and otherwise emits that warning.

We should do something on the Guile side to fix this, perhaps by
allowing users to annotate identifiers as being gettext-like procedures.

Thoughts?

Ludo’.



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

2017-04-22 Thread Tobias Geerinckx-Rice
Ludo',

On 21/04/17 19:24, Ludovic Courtès wrote:
> 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: [...]

Thanks for the explanation :-)

Kind regards,

T G-R



signature.asc
Description: OpenPGP digital signature


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

2017-04-22 Thread Alex Kost
Mark H Weaver (2017-04-21 14:05 -0400) wrote:

> l...@gnu.org (Ludovic Courtès) writes:
>> 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?
>
> I agree that renaming '_' in (guix ui) is the better approach.

Using '_' to match "something that I don't care about" is such a common
thing, that I would also prefer to rename '_' in (guix ui).

-- 
Alex



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

2017-04-21 Thread Mark H Weaver
l...@gnu.org (Ludovic Courtès) writes:
> 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?

I agree that renaming '_' in (guix ui) is the better approach.

  Mark



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

2017-04-21 Thread Ludovic Courtès
Hi,

Tobias Geerinckx-Rice  skribis:

> On 21/04/17 17:24, Ludovic Court�s wrote:
>> commit ba97e454bfbc168098212b37881b50b4fe6e1eb2 Author: Ludovic
>> Courtès  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’.



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

2017-04-21 Thread Tobias Geerinckx-Rice
Ludo',

On 21/04/17 17:24, Ludovic Court�s wrote:
> commit ba97e454bfbc168098212b37881b50b4fe6e1eb2 Author: Ludovic
> Courtès  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?

(Apologies if I missed a thread about this somewhere. I suspect this
 has something to do with Guile 2.2, but could use some help finding
 out what to search for.)

Kind regards,

T G-R



signature.asc
Description: OpenPGP digital signature