unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Feedback on indentation rules (was: [PATCH 0/5] Add support for the RPM format to "guix pack")
       [not found]       ` <871qmg5qpj.fsf@gnu.org>
@ 2023-02-23 22:20         ` Maxim Cournoyer
  2023-02-27 19:14           ` Efraim Flashner
  0 siblings, 1 reply; 10+ messages in thread
From: Maxim Cournoyer @ 2023-02-23 22:20 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

-CC bug#61255
+CC guix-devel

Hi Ludovic and guix-devel readers,

Ludovic Courtès <ludo@gnu.org> writes:

> Hi,
>
> Maxim Cournoyer <maxim.cournoyer@gmail.com> skribis:
>
>> Ludovic Courtès <ludo@gnu.org> writes:
>>

[...]

>>> I’m not convinced by the indentation rule for ‘gexp->derivation’ added
>>> in 82daab42811a2e3c7684ebdf12af75ff0fa67b99: there’s no reason to treat
>>> ‘gexp->derivation’ differently from other procedures.
>>
>> The benefit I saw was that writing
>>
>>  (gexp->derivation the-name
>>   #~(begin
>>      (the
>>        (multi-line
>>         (gexp)))))
>
> I understand, but you know, it’s best to avoid unilaterally changing
> established conventions.  :-)
>
> If and when there’s consensus about this change, (guix read-print)
> should be updated.

OK.  I'm not against soliciting more opinions; I'm CC'ing guix-devel,
hoping some opinionated individuals tip in on this 2021
82daab42811a2e3c7684ebdf12af75ff0fa67b99 commit, more specifically, the
part that change the indentation rules for .dir-locals.el like this:

--8<---------------cut here---------------start------------->8---
+   (eval . (put 'gexp->derivation 'scheme-indent-function 1))
--8<---------------cut here---------------end--------------->8---

In the same spirit there was also
b1c25e2ce364741d1c257d3bb3ab773032807a80 (".dir-locals.el: Add
indentation rule for computed-file.") made more recently (last month).

The idea was to be able to format gexp->derivation like this:

--8<---------------cut here---------------start------------->8---
          (gexp->derivation "check-deb-pack"
            (with-imported-modules '((guix build utils))
              #~(begin
                  (use-modules (guix build utils)
                               (ice-9 match)
                               (ice-9 popen)
                               (ice-9 rdelim)
                               (ice-9 textual-ports)
                               (rnrs base))
[...]
--8<---------------cut here---------------end--------------->8---

Rather than like this:

--8<---------------cut here---------------start------------->8---
          (gexp->derivation "check-deb-pack"
                            (with-imported-modules '((guix build utils))
                              #~(begin
                                  (use-modules (guix build utils)
                                               (ice-9 match)
                                               (ice-9 popen)
                                               (ice-9 rdelim)
                                               (ice-9 textual-ports)
                                               (rnrs base))
--8<---------------cut here---------------end--------------->8---

(or having to use another 'builder' variable, for example).

What do you all think?

-- 
Thanks,
Maxim


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

* Re: Feedback on indentation rules (was: [PATCH 0/5] Add support for the RPM format to "guix pack")
  2023-02-23 22:20         ` Feedback on indentation rules (was: [PATCH 0/5] Add support for the RPM format to "guix pack") Maxim Cournoyer
@ 2023-02-27 19:14           ` Efraim Flashner
  2023-03-01 15:17             ` Feedback on indentation rules Maxim Cournoyer
  0 siblings, 1 reply; 10+ messages in thread
From: Efraim Flashner @ 2023-02-27 19:14 UTC (permalink / raw)
  To: Maxim Cournoyer; +Cc: Ludovic Courtès, guix-devel

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

On Thu, Feb 23, 2023 at 05:20:55PM -0500, Maxim Cournoyer wrote:
> -CC bug#61255
> +CC guix-devel
> 
> Hi Ludovic and guix-devel readers,
> 
> Ludovic Courtès <ludo@gnu.org> writes:
> 
> > Hi,
> >
> > Maxim Cournoyer <maxim.cournoyer@gmail.com> skribis:
> >
> >> Ludovic Courtès <ludo@gnu.org> writes:
> >>
> 
> [...]
> 
> >>> I’m not convinced by the indentation rule for ‘gexp->derivation’ added
> >>> in 82daab42811a2e3c7684ebdf12af75ff0fa67b99: there’s no reason to treat
> >>> ‘gexp->derivation’ differently from other procedures.
> >>
> >> The benefit I saw was that writing
> >>
> >>  (gexp->derivation the-name
> >>   #~(begin
> >>      (the
> >>        (multi-line
> >>         (gexp)))))
> >
> > I understand, but you know, it’s best to avoid unilaterally changing
> > established conventions.  :-)
> >
> > If and when there’s consensus about this change, (guix read-print)
> > should be updated.
> 
> OK.  I'm not against soliciting more opinions; I'm CC'ing guix-devel,
> hoping some opinionated individuals tip in on this 2021
> 82daab42811a2e3c7684ebdf12af75ff0fa67b99 commit, more specifically, the
> part that change the indentation rules for .dir-locals.el like this:
> 
> --8<---------------cut here---------------start------------->8---
> +   (eval . (put 'gexp->derivation 'scheme-indent-function 1))
> --8<---------------cut here---------------end--------------->8---
> 
> In the same spirit there was also
> b1c25e2ce364741d1c257d3bb3ab773032807a80 (".dir-locals.el: Add
> indentation rule for computed-file.") made more recently (last month).
> 
> The idea was to be able to format gexp->derivation like this:
> 
> --8<---------------cut here---------------start------------->8---
>           (gexp->derivation "check-deb-pack"
>             (with-imported-modules '((guix build utils))
>               #~(begin
>                   (use-modules (guix build utils)
>                                (ice-9 match)
>                                (ice-9 popen)
>                                (ice-9 rdelim)
>                                (ice-9 textual-ports)
>                                (rnrs base))
> [...]
> --8<---------------cut here---------------end--------------->8---
> 
> Rather than like this:
> 
> --8<---------------cut here---------------start------------->8---
>           (gexp->derivation "check-deb-pack"
>                             (with-imported-modules '((guix build utils))
>                               #~(begin
>                                   (use-modules (guix build utils)
>                                                (ice-9 match)
>                                                (ice-9 popen)
>                                                (ice-9 rdelim)
>                                                (ice-9 textual-ports)
>                                                (rnrs base))
> --8<---------------cut here---------------end--------------->8---
> 
> (or having to use another 'builder' variable, for example).
> 
> What do you all think?

The second one is waaaay to indented. For myself I sometimes end up
wrapping the lines (although I don't love it) so it looks like this:

           (gexp->derivation
             "check-deb-pack"
             (with-imported-modules '((guix build utils))
               #~(begin
                   (use-modules (guix build utils)
                                (ice-9 match)
                                (ice-9 popen)
                                (ice-9 rdelim)
                                (ice-9 textual-ports)
                                (rnrs base))

-- 
Efraim Flashner   <efraim@flashner.co.il>   אפרים פלשנר
GPG key = A28B F40C 3E55 1372 662D  14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: Feedback on indentation rules
  2023-02-27 19:14           ` Efraim Flashner
@ 2023-03-01 15:17             ` Maxim Cournoyer
  2023-03-06 16:56               ` Ludovic Courtès
  0 siblings, 1 reply; 10+ messages in thread
From: Maxim Cournoyer @ 2023-03-01 15:17 UTC (permalink / raw)
  To: efraim; +Cc: Ludovic Courtès, guix-devel

Hi Efraim,

Efraim Flashner <efraim@flashner.co.il> writes:

> On Thu, Feb 23, 2023 at 05:20:55PM -0500, Maxim Cournoyer wrote:
>> -CC bug#61255
>> +CC guix-devel
>> 
>> Hi Ludovic and guix-devel readers,
>> 
>> Ludovic Courtès <ludo@gnu.org> writes:
>> 
>> > Hi,
>> >
>> > Maxim Cournoyer <maxim.cournoyer@gmail.com> skribis:
>> >
>> >> Ludovic Courtès <ludo@gnu.org> writes:
>> >>
>> 
>> [...]
>> 
>> >>> I’m not convinced by the indentation rule for ‘gexp->derivation’ added
>> >>> in 82daab42811a2e3c7684ebdf12af75ff0fa67b99: there’s no reason to treat
>> >>> ‘gexp->derivation’ differently from other procedures.
>> >>
>> >> The benefit I saw was that writing
>> >>
>> >>  (gexp->derivation the-name
>> >>   #~(begin
>> >>      (the
>> >>        (multi-line
>> >>         (gexp)))))
>> >
>> > I understand, but you know, it’s best to avoid unilaterally changing
>> > established conventions.  :-)
>> >
>> > If and when there’s consensus about this change, (guix read-print)
>> > should be updated.
>> 
>> OK.  I'm not against soliciting more opinions; I'm CC'ing guix-devel,
>> hoping some opinionated individuals tip in on this 2021
>> 82daab42811a2e3c7684ebdf12af75ff0fa67b99 commit, more specifically, the
>> part that change the indentation rules for .dir-locals.el like this:
>> 
>> --8<---------------cut here---------------start------------->8---
>> +   (eval . (put 'gexp->derivation 'scheme-indent-function 1))
>> --8<---------------cut here---------------end--------------->8---
>> 
>> In the same spirit there was also
>> b1c25e2ce364741d1c257d3bb3ab773032807a80 (".dir-locals.el: Add
>> indentation rule for computed-file.") made more recently (last month).
>> 
>> The idea was to be able to format gexp->derivation like this:
>> 
>> --8<---------------cut here---------------start------------->8---
>>           (gexp->derivation "check-deb-pack"
>>             (with-imported-modules '((guix build utils))
>>               #~(begin
>>                   (use-modules (guix build utils)
>>                                (ice-9 match)
>>                                (ice-9 popen)
>>                                (ice-9 rdelim)
>>                                (ice-9 textual-ports)
>>                                (rnrs base))
>> [...]
>> --8<---------------cut here---------------end--------------->8---
>> 
>> Rather than like this:
>> 
>> --8<---------------cut here---------------start------------->8---
>>           (gexp->derivation "check-deb-pack"
>>                             (with-imported-modules '((guix build utils))
>>                               #~(begin
>>                                   (use-modules (guix build utils)
>>                                                (ice-9 match)
>>                                                (ice-9 popen)
>>                                                (ice-9 rdelim)
>>                                                (ice-9 textual-ports)
>>                                                (rnrs base))
>> --8<---------------cut here---------------end--------------->8---
>> 
>> (or having to use another 'builder' variable, for example).
>> 
>> What do you all think?
>
> The second one is waaaay to indented. For myself I sometimes end up
> wrapping the lines (although I don't love it) so it looks like this:
>
>            (gexp->derivation
>              "check-deb-pack"
>              (with-imported-modules '((guix build utils))
>                #~(begin
>                    (use-modules (guix build utils)
>                                 (ice-9 match)
>                                 (ice-9 popen)
>                                 (ice-9 rdelim)
>                                 (ice-9 textual-ports)
>                                 (rnrs base))

Thanks for the feedback.  I wonder if some are of the opinion that since
gexp->derivation is a plain function rather than a syntax having a
special form for its 2nd argument, we should leave the default
indentation rules untouched for it?

My take on this would be a pragmatic one: readable code trumps
indentation rules purity, but I'm interested to gather all the views.

-- 
Thanks,
Maxim


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

* Re: Feedback on indentation rules
  2023-03-01 15:17             ` Feedback on indentation rules Maxim Cournoyer
@ 2023-03-06 16:56               ` Ludovic Courtès
  2023-03-07 13:46                 ` Simon Tournier
  0 siblings, 1 reply; 10+ messages in thread
From: Ludovic Courtès @ 2023-03-06 16:56 UTC (permalink / raw)
  To: Maxim Cournoyer; +Cc: efraim, guix-devel

Hi,

Maxim Cournoyer <maxim.cournoyer@gmail.com> skribis:

> Thanks for the feedback.  I wonder if some are of the opinion that since
> gexp->derivation is a plain function rather than a syntax having a
> special form for its 2nd argument, we should leave the default
> indentation rules untouched for it?

Yes, that’s my take and current practice so far: special rules for
special forms (macros), not for procedures.

Ludo’.


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

* Re: Feedback on indentation rules
  2023-03-06 16:56               ` Ludovic Courtès
@ 2023-03-07 13:46                 ` Simon Tournier
  2023-03-07 16:54                   ` Maxim Cournoyer
  2023-03-15 16:15                   ` Ludovic Courtès
  0 siblings, 2 replies; 10+ messages in thread
From: Simon Tournier @ 2023-03-07 13:46 UTC (permalink / raw)
  To: Ludovic Courtès, Maxim Cournoyer; +Cc: efraim, guix-devel

Hi,

On Mon, 06 Mar 2023 at 17:56, Ludovic Courtès <ludo@gnu.org> wrote:
> Maxim Cournoyer <maxim.cournoyer@gmail.com> skribis:
>
>> Thanks for the feedback.  I wonder if some are of the opinion that since
>> gexp->derivation is a plain function rather than a syntax having a
>> special form for its 2nd argument, we should leave the default
>> indentation rules untouched for it?
>
> Yes, that’s my take and current practice so far: special rules for
> special forms (macros), not for procedures.

What is the rationale?  Being able to know directly at the location when
it is a plain function or a special form?

For what it is worth, I do not see an high difference between the both
indentations.  So, my opinion would to keep the current practise.


Cheers,
simon


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

* Re: Feedback on indentation rules
  2023-03-07 13:46                 ` Simon Tournier
@ 2023-03-07 16:54                   ` Maxim Cournoyer
  2023-03-07 17:29                     ` Simon Tournier
  2023-03-15 16:15                   ` Ludovic Courtès
  1 sibling, 1 reply; 10+ messages in thread
From: Maxim Cournoyer @ 2023-03-07 16:54 UTC (permalink / raw)
  To: Simon Tournier; +Cc: Ludovic Courtès, efraim, guix-devel

Hi Simon,

Simon Tournier <zimon.toutoune@gmail.com> writes:

> Hi,
>
> On Mon, 06 Mar 2023 at 17:56, Ludovic Courtès <ludo@gnu.org> wrote:
>> Maxim Cournoyer <maxim.cournoyer@gmail.com> skribis:
>>
>>> Thanks for the feedback.  I wonder if some are of the opinion that since
>>> gexp->derivation is a plain function rather than a syntax having a
>>> special form for its 2nd argument, we should leave the default
>>> indentation rules untouched for it?
>>
>> Yes, that’s my take and current practice so far: special rules for
>> special forms (macros), not for procedures.
>
> What is the rationale?  Being able to know directly at the location when
> it is a plain function or a special form?
>
> For what it is worth, I do not see an high difference between the both
> indentations.  So, my opinion would to keep the current practise.

Please take a look at my original message in this thread,
https://lists.gnu.org/archive/html/guix-devel/2023-02/msg00297.html,
where I gave examples of gexp->derivation indentations that should
explain the rationale allow nesting arguments more naturally, as if
gexp->derivation was a special form (although it's a simple procedure).

-- 
Thanks,
Maxim


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

* Re: Feedback on indentation rules
  2023-03-07 16:54                   ` Maxim Cournoyer
@ 2023-03-07 17:29                     ` Simon Tournier
  2023-03-09 13:55                       ` Maxim Cournoyer
  0 siblings, 1 reply; 10+ messages in thread
From: Simon Tournier @ 2023-03-07 17:29 UTC (permalink / raw)
  To: Maxim Cournoyer; +Cc: Ludovic Courtès, efraim, guix-devel

Hi Maxim,

On Tue, 07 Mar 2023 at 11:54, Maxim Cournoyer <maxim.cournoyer@gmail.com> wrote:

>> For what it is worth, I do not see an high difference between the both
>> indentations.  So, my opinion would to keep the current practise.
>
> Please take a look at my original message in this thread,
> https://lists.gnu.org/archive/html/guix-devel/2023-02/msg00297.html,
> where I gave examples of gexp->derivation indentations that should
> explain the rationale allow nesting arguments more naturally, as if
> gexp->derivation was a special form (although it's a simple procedure).

Yeah, I have read this rationale before. :-)

My question was somehow directed to Ludo:

        > Yes, that’s my take and current practice so far: special rules for
        > special forms (macros), not for procedures.

        What is the rationale?  Being able to know directly at the location when
        it is a plain function or a special form?

Sorry for having been unclear.

And I do not see a big difference between,

          (gexp->derivation "check-deb-pack"
            (with-imported-modules '((guix build utils))

or

          (gexp->derivation "check-deb-pack"
                            (with-imported-modules '((guix build utils))

It is somehow personal cosmetic and I am sometimes poor person about
cosmetic. ;-)

Well, from my point of view, based on consistency with current
practises, I would be inclined to keep the status quo: special rule for
special form.

Cheers,
simon


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

* Re: Feedback on indentation rules
  2023-03-07 17:29                     ` Simon Tournier
@ 2023-03-09 13:55                       ` Maxim Cournoyer
  0 siblings, 0 replies; 10+ messages in thread
From: Maxim Cournoyer @ 2023-03-09 13:55 UTC (permalink / raw)
  To: Simon Tournier; +Cc: Ludovic Courtès, efraim, guix-devel

Hi Simon,

Simon Tournier <zimon.toutoune@gmail.com> writes:

> Hi Maxim,
>
> On Tue, 07 Mar 2023 at 11:54, Maxim Cournoyer <maxim.cournoyer@gmail.com> wrote:
>
>>> For what it is worth, I do not see an high difference between the both
>>> indentations.  So, my opinion would to keep the current practise.
>>
>> Please take a look at my original message in this thread,
>> https://lists.gnu.org/archive/html/guix-devel/2023-02/msg00297.html,
>> where I gave examples of gexp->derivation indentations that should
>> explain the rationale allow nesting arguments more naturally, as if
>> gexp->derivation was a special form (although it's a simple procedure).
>
> Yeah, I have read this rationale before. :-)
>
> My question was somehow directed to Ludo:
>
>         > Yes, that’s my take and current practice so far: special rules for
>         > special forms (macros), not for procedures.
>
>         What is the rationale?  Being able to know directly at the location when
>         it is a plain function or a special form?
>
> Sorry for having been unclear.
>
> And I do not see a big difference between,
>
>           (gexp->derivation "check-deb-pack"
>             (with-imported-modules '((guix build utils))
>
> or
>
>           (gexp->derivation "check-deb-pack"
>                             (with-imported-modules '((guix build utils))
>
> It is somehow personal cosmetic and I am sometimes poor person about
> cosmetic. ;-)

In the second case, we end up busting the 80 chars limit easily, so it
usually ends up formatted as:

--8<---------------cut here---------------start------------->8---
            (gexp->derivation
             "check-deb-pack"
             (with-imported-modules '((guix build utils))
              [...]

or

            (define builder
              #~(the builder code))

            (gexp->derivation
             "name"
             builder)
--8<---------------cut here---------------end--------------->8---

Which is not very natural (in fact, I had found already used
indentation like 1) in tests/pack.scm before I adjusted the
.dir-locals.el file to match it, otherwise Emacs was re-indenting them
differently).

-- 
Thanks,
Maxim


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

* Re: Feedback on indentation rules
  2023-03-07 13:46                 ` Simon Tournier
  2023-03-07 16:54                   ` Maxim Cournoyer
@ 2023-03-15 16:15                   ` Ludovic Courtès
  2023-03-17 16:16                     ` Maxim Cournoyer
  1 sibling, 1 reply; 10+ messages in thread
From: Ludovic Courtès @ 2023-03-15 16:15 UTC (permalink / raw)
  To: Simon Tournier; +Cc: Maxim Cournoyer, efraim, guix-devel

Hi,

Simon Tournier <zimon.toutoune@gmail.com> skribis:

> On Mon, 06 Mar 2023 at 17:56, Ludovic Courtès <ludo@gnu.org> wrote:
>> Maxim Cournoyer <maxim.cournoyer@gmail.com> skribis:
>>
>>> Thanks for the feedback.  I wonder if some are of the opinion that since
>>> gexp->derivation is a plain function rather than a syntax having a
>>> special form for its 2nd argument, we should leave the default
>>> indentation rules untouched for it?
>>
>> Yes, that’s my take and current practice so far: special rules for
>> special forms (macros), not for procedures.
>
> What is the rationale?  Being able to know directly at the location when
> it is a plain function or a special form?

Yes.

Now, it’s aesthetics so there’s no “rationale” per se but rather
established practice: in the project, but also from what I can see in
Guile and more generally Scheme (info "(guix) Formatting Code").

Ludo’.


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

* Re: Feedback on indentation rules
  2023-03-15 16:15                   ` Ludovic Courtès
@ 2023-03-17 16:16                     ` Maxim Cournoyer
  0 siblings, 0 replies; 10+ messages in thread
From: Maxim Cournoyer @ 2023-03-17 16:16 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: Simon Tournier, efraim, guix-devel

Hello,

Ludovic Courtès <ludo@gnu.org> writes:

> Hi,
>
> Simon Tournier <zimon.toutoune@gmail.com> skribis:
>
>> On Mon, 06 Mar 2023 at 17:56, Ludovic Courtès <ludo@gnu.org> wrote:
>>> Maxim Cournoyer <maxim.cournoyer@gmail.com> skribis:
>>>
>>>> Thanks for the feedback.  I wonder if some are of the opinion that since
>>>> gexp->derivation is a plain function rather than a syntax having a
>>>> special form for its 2nd argument, we should leave the default
>>>> indentation rules untouched for it?
>>>
>>> Yes, that’s my take and current practice so far: special rules for
>>> special forms (macros), not for procedures.
>>
>> What is the rationale?  Being able to know directly at the location when
>> it is a plain function or a special form?
>
> Yes.
>
> Now, it’s aesthetics so there’s no “rationale” per se but rather
> established practice: in the project, but also from what I can see in
> Guile and more generally Scheme (info "(guix) Formatting Code").

See commits d0b7858968a2c8c8cdacc3679447b250fb5b4dd9 and
933051281fbed0ae71bd40c24a701faf2a02791c, where I reverted to status quo
w.r.t. indentation rules of gexp->derivation and computed-file, given
the lack of clear consensus.

-- 
Thanks,
Maxim


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

end of thread, other threads:[~2023-03-17 16:17 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20230203221409.15886-2-maxim.cournoyer@gmail.com>
     [not found] ` <20230203221409.15886-5-maxim.cournoyer@gmail.com>
     [not found]   ` <87357alp9n.fsf_-_@gnu.org>
     [not found]     ` <878rgxws6l.fsf@gmail.com>
     [not found]       ` <871qmg5qpj.fsf@gnu.org>
2023-02-23 22:20         ` Feedback on indentation rules (was: [PATCH 0/5] Add support for the RPM format to "guix pack") Maxim Cournoyer
2023-02-27 19:14           ` Efraim Flashner
2023-03-01 15:17             ` Feedback on indentation rules Maxim Cournoyer
2023-03-06 16:56               ` Ludovic Courtès
2023-03-07 13:46                 ` Simon Tournier
2023-03-07 16:54                   ` Maxim Cournoyer
2023-03-07 17:29                     ` Simon Tournier
2023-03-09 13:55                       ` Maxim Cournoyer
2023-03-15 16:15                   ` Ludovic Courtès
2023-03-17 16:16                     ` Maxim Cournoyer

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