unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Re: 04/04: offload: Avoid using '_' as a 'match' pattern.
       [not found] ` <20170421152430.15A4A21037@vcs0.savannah.gnu.org>
@ 2017-04-21 16:16   ` Tobias Geerinckx-Rice
  2017-04-21 17:24     ` Ludovic Courtès
  0 siblings, 1 reply; 6+ messages in thread
From: Tobias Geerinckx-Rice @ 2017-04-21 16:16 UTC (permalink / raw)
  To: guix-devel


[-- Attachment #1.1: Type: text/plain, Size: 728 bytes --]

Ludo',

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


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 504 bytes --]

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

* Re: 04/04: offload: Avoid using '_' as a 'match' pattern.
  2017-04-21 16:16   ` 04/04: offload: Avoid using '_' as a 'match' pattern Tobias Geerinckx-Rice
@ 2017-04-21 17:24     ` Ludovic Courtès
  2017-04-21 18:05       ` Mark H Weaver
  2017-04-22 18:46       ` Tobias Geerinckx-Rice
  0 siblings, 2 replies; 6+ messages in thread
From: Ludovic Courtès @ 2017-04-21 17:24 UTC (permalink / raw)
  To: Tobias Geerinckx-Rice; +Cc: guix-devel

Hi,

Tobias Geerinckx-Rice <me@tobias.gr> skribis:

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

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

* Re: 04/04: offload: Avoid using '_' as a 'match' pattern.
  2017-04-21 17:24     ` Ludovic Courtès
@ 2017-04-21 18:05       ` Mark H Weaver
  2017-04-22 18:15         ` Alex Kost
  2017-05-03 14:18         ` Ludovic Courtès
  2017-04-22 18:46       ` Tobias Geerinckx-Rice
  1 sibling, 2 replies; 6+ messages in thread
From: Mark H Weaver @ 2017-04-21 18:05 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

ludo@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

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

* Re: 04/04: offload: Avoid using '_' as a 'match' pattern.
  2017-04-21 18:05       ` Mark H Weaver
@ 2017-04-22 18:15         ` Alex Kost
  2017-05-03 14:18         ` Ludovic Courtès
  1 sibling, 0 replies; 6+ messages in thread
From: Alex Kost @ 2017-04-22 18:15 UTC (permalink / raw)
  To: Mark H Weaver; +Cc: guix-devel

Mark H Weaver (2017-04-21 14:05 -0400) wrote:

> ludo@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

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

* Re: 04/04: offload: Avoid using '_' as a 'match' pattern.
  2017-04-21 17:24     ` Ludovic Courtès
  2017-04-21 18:05       ` Mark H Weaver
@ 2017-04-22 18:46       ` Tobias Geerinckx-Rice
  1 sibling, 0 replies; 6+ messages in thread
From: Tobias Geerinckx-Rice @ 2017-04-22 18:46 UTC (permalink / raw)
  To: ludo; +Cc: guix-devel


[-- Attachment #1.1: Type: text/plain, Size: 379 bytes --]

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


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 504 bytes --]

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

* Re: 04/04: offload: Avoid using '_' as a 'match' pattern.
  2017-04-21 18:05       ` Mark H Weaver
  2017-04-22 18:15         ` Alex Kost
@ 2017-05-03 14:18         ` Ludovic Courtès
  1 sibling, 0 replies; 6+ messages in thread
From: Ludovic Courtès @ 2017-05-03 14:18 UTC (permalink / raw)
  To: Mark H Weaver; +Cc: guix-devel

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

> ludo@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’.

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

end of thread, other threads:[~2017-05-03 14:18 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20170421152428.28671.46379@vcs0.savannah.gnu.org>
     [not found] ` <20170421152430.15A4A21037@vcs0.savannah.gnu.org>
2017-04-21 16:16   ` 04/04: offload: Avoid using '_' as a 'match' pattern Tobias Geerinckx-Rice
2017-04-21 17:24     ` Ludovic Courtès
2017-04-21 18:05       ` Mark H Weaver
2017-04-22 18:15         ` Alex Kost
2017-05-03 14:18         ` Ludovic Courtès
2017-04-22 18:46       ` Tobias Geerinckx-Rice

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).