Mailing List Archive

Tab indentation to space indentation pull requests
In pod/perlhack.pod there are such lines:

> =head3 Style
>
> In general, please follow the particular style of the code you are
> patching.
>
> In particular, follow these general guidelines for patching Perl
> sources:
>
> =over 4
>
> =item *
>
> 4-wide indents for code, 2-wide indents for nested CPP C<#define>s,
> with 8-wide tabstops.
>
> =item *
>
> Use spaces for indentation, not tab characters.
>
> The codebase is a mixture of tabs and spaces for indentation, and we
> are moving to spaces only. Converting lines you're patching from 8-wide
> tabs to spaces will help this migration.

Is it acceptable to create pull-requests just for such tab/spaces
substitutions? If yes for which files the answer is no and why?
Re: Tab indentation to space indentation pull requests [ In reply to ]
On Sun, Apr 11, 2021 at 6:08 PM ?????? ???????? <mchlkzch@gmail.com> wrote:

> In pod/perlhack.pod there are such lines:
>
> > =head3 Style
> >
> > In general, please follow the particular style of the code you are
> > patching.
> >
> > In particular, follow these general guidelines for patching Perl
> > sources:
> >
> > =over 4
> >
> > =item *
> >
> > 4-wide indents for code, 2-wide indents for nested CPP C<#define>s,
> > with 8-wide tabstops.
> >
> > =item *
> >
> > Use spaces for indentation, not tab characters.
> >
> > The codebase is a mixture of tabs and spaces for indentation, and we
> > are moving to spaces only. Converting lines you're patching from 8-wide
> > tabs to spaces will help this migration.
>
> Is it acceptable to create pull-requests just for such tab/spaces
> substitutions? If yes for which files the answer is no and why?
>

Generally not, because it adds history churn for little benefit. But it is
reasonable to do such conversion within code which is updated for other
reasons. It's also possible a mass-conversion to consistent indenting will
be accepted, if it has a specific scope and is not doing anything else at
the same time - this was recently done for C code in
https://github.com/Perl/perl5/pull/18446.

-Dan
Re: Tab indentation to space indentation pull requests [ In reply to ]
"But it is reasonable to do such conversion within code which is updated
for other reasons"
is it just a private opinion or an established practice for it? If the
second one does places
in pod files exist where it is described? If not may be it will be
helpful to add some notice
about it there? Just for clarify rules for perl contributors.

On 4/12/21 1:18 AM, Dan Book wrote:
> Generally not, because it adds history churn for little benefit. But
> it is reasonable to do such
> conversion within code which is updated for other reasons
Re: Tab indentation to space indentation pull requests [ In reply to ]
On Mon, Apr 12, 2021 at 12:08 AM ?????? ???????? <mchlkzch@gmail.com> wrote:
>
> In pod/perlhack.pod there are such lines:
>
> > =head3 Style
> >
> > In general, please follow the particular style of the code you are
> > patching.
> >
> > In particular, follow these general guidelines for patching Perl
> > sources:
> >
> > =over 4
> >
> > =item *
> >
> > 4-wide indents for code, 2-wide indents for nested CPP C<#define>s,
> > with 8-wide tabstops.
> >
> > =item *
> >
> > Use spaces for indentation, not tab characters.
> >
> > The codebase is a mixture of tabs and spaces for indentation, and we
> > are moving to spaces only. Converting lines you're patching from 8-wide
> > tabs to spaces will help this migration.
>
> Is it acceptable to create pull-requests just for such tab/spaces
> substitutions? If yes for which files the answer is no and why?

The difficult thing here is that because of our 34 year history, we
have 2 different indentation standards (and some code satisfying
neither).

The old one mixed tabs and spaces (one indent was 4 spaces, two
indents was one tab, three indents was one tab and 4 spaces). This was
widely hated for reasons that I probably don't have to explain. The
new one is 4-spaces. This is generally considered more sane, but this
change does have the distinct disadvantage of leading to
inconsistently indented files.

In my experience, it can be beneficial to convert files that are
heavily mixed, but it isn't necessarily helpful to do so preemptively.
Or at least, that's not what we have generally done so far. All the
options kind of stink here.

Leon
Re: Tab indentation to space indentation pull requests [ In reply to ]
??????

Do you want to convert tabs in Perl core source code to spaces?

In my personal experience, when I read the Perl source code, the
indentation breaks down in my editor.


2021?4?12?(?) 8:23 Leon Timmermans <fawaka@gmail.com>:

> On Mon, Apr 12, 2021 at 12:08 AM ?????? ???????? <mchlkzch@gmail.com>
> wrote:
> >
> > In pod/perlhack.pod there are such lines:
> >
> > > =head3 Style
> > >
> > > In general, please follow the particular style of the code you are
> > > patching.
> > >
> > > In particular, follow these general guidelines for patching Perl
> > > sources:
> > >
> > > =over 4
> > >
> > > =item *
> > >
> > > 4-wide indents for code, 2-wide indents for nested CPP C<#define>s,
> > > with 8-wide tabstops.
> > >
> > > =item *
> > >
> > > Use spaces for indentation, not tab characters.
> > >
> > > The codebase is a mixture of tabs and spaces for indentation, and we
> > > are moving to spaces only. Converting lines you're patching from
> 8-wide
> > > tabs to spaces will help this migration.
> >
> > Is it acceptable to create pull-requests just for such tab/spaces
> > substitutions? If yes for which files the answer is no and why?
>
> The difficult thing here is that because of our 34 year history, we
> have 2 different indentation standards (and some code satisfying
> neither).
>
> The old one mixed tabs and spaces (one indent was 4 spaces, two
> indents was one tab, three indents was one tab and 4 spaces). This was
> widely hated for reasons that I probably don't have to explain. The
> new one is 4-spaces. This is generally considered more sane, but this
> change does have the distinct disadvantage of leading to
> inconsistently indented files.
>
> In my experience, it can be beneficial to convert files that are
> heavily mixed, but it isn't necessarily helpful to do so preemptively.
> Or at least, that's not what we have generally done so far. All the
> options kind of stink here.
>
> Leon
>
Re: Tab indentation to space indentation pull requests [ In reply to ]
> the indentation breaks down in my editor.

Not only yours, mine too. Sometime it's "impossible" to read the written.

> Do you want to convert tabs in Perl core source code to spaces?

It would be fine, but I don't know how to do it properly in view of
aforesaid responses.

On 4/12/21 4:59 AM, Yuki Kimoto wrote:
> ??????
>
> Do you want to convert tabs in Perl core source code to spaces?
>
> In my personal experience, when I read the Perl source code, the
> indentation breaks down in my editor.
>
>
> 2021?4?12?(?) 8:23 Leon Timmermans <fawaka@gmail.com
> <mailto:fawaka@gmail.com>>:
>
> On Mon, Apr 12, 2021 at 12:08 AM ?????? ???????? <mchlkzch@gmail.com
> <mailto:mchlkzch@gmail.com>> wrote:
> >
> > In pod/perlhack.pod there are such lines:
> >
> > > =head3 Style
> > >
> > > In general, please follow the particular style of the code you are
> > > patching.
> > >
> > > In particular, follow these general guidelines for patching Perl
> > > sources:
> > >
> > > =over 4
> > >
> > > =item *
> > >
> > > 4-wide indents for code, 2-wide indents for nested CPP C<#define>s,
> > > with 8-wide tabstops.
> > >
> > > =item *
> > >
> > > Use spaces for indentation, not tab characters.
> > >
> > > The codebase is a mixture of tabs and spaces for indentation,
> and we
> > > are moving to spaces only.  Converting lines you're patching
> from 8-wide
> > > tabs to spaces will help this migration.
> >
> > Is it acceptable to create pull-requests just for such tab/spaces
> > substitutions? If yes for which files the answer is no and why?
>
> The difficult thing here is that because of our 34 year history, we
> have 2 different indentation standards (and some code satisfying
> neither).
>
> The old one mixed tabs and spaces (one indent was 4 spaces, two
> indents was one tab, three indents was one tab and 4 spaces). This was
> widely hated for reasons that I probably don't have to explain. The
> new one is 4-spaces. This is generally considered more sane, but this
> change does have the distinct disadvantage of leading to
> inconsistently indented files.
>
> In my experience, it can be beneficial to convert files that are
> heavily mixed, but it isn't necessarily helpful to do so preemptively.
> Or at least, that's not what we have generally done so far. All the
> options kind of stink here.
>
> Leon
>
RE: Tab indentation to space indentation pull requests [ In reply to ]
> > the indentation breaks down in my editor.
>
> Not only yours, mine too. Sometime it's "impossible" to read the written.

...then you need a better editor
(c) Larry Wall
Re: Tab indentation to space indentation pull requests [ In reply to ]
On Mon, Apr 12, 2021 at 12:25:07PM +0000, Konovalov, Vadim wrote:
> > > the indentation breaks down in my editor.
> >
> > Not only yours, mine too. Sometime it's "impossible" to read the written.
>
> ...then you need a better editor
> (c) Larry Wall

But we have editor blocks for vi and emacs to set things up correctly
(ie indent at 4 spaces, show tabs as four spaces, expand tabs) - doesn't
that cover everyone? :-)

Oh wait, apparently there are new forms of heresy in the editor wars.

I am aware of https://editorconfig.org/

I am not familiar with how to set it up (because I have not needed to)

But I don't see an .editorconfig file.

Is it viable to add one that tells the entire pantheon of editors how to
render the indenting sensibly?

Nicholas Clark
RE: Tab indentation to space indentation pull requests [ In reply to ]
> > > > the indentation breaks down in my editor.
> > >
> > > Not only yours, mine too. Sometime it's "impossible" to read the written.
> >
> > ...then you need a better editor
> > (c) Larry Wall

http://skuld.bmsc.washington.edu/people/merritt/text/perl6.html

>
> But we have editor blocks for vi and emacs to set things up correctly (ie
> indent at 4 spaces, show tabs as four spaces, expand tabs) - doesn't that cover
> everyone? :-)
>
> Oh wait, apparently there are new forms of heresy in the editor
> wars.

To avoid editor war, I propose to introduce

use warnings, FATAL => 'indented-tab';

...and make it default in v7.1

Before that - we need to stuff this line into every single "*.p[ml]" and *.t file.
Name it next modernization step.
This is our string point: deprecating "threads" and stuffing "use warnings" everywhere.

This is feasible: python3 issues an error for indentation tabs.
Can we learn from python on this?
Re: Tab indentation to space indentation pull requests [ In reply to ]
On Mon, 12 Apr 2021 12:43:49 +0000, "Konovalov, Vadim"
<Vadim.Konovalov@dell.com> wrote:

> [...]
> [...]
> > >
> > > ...then you need a better editor
> > > (c) Larry Wall
>
> http://skuld.bmsc.washington.edu/people/merritt/text/perl6.html
>
> > But we have editor blocks for vi and emacs to set things up
> > correctly (ie indent at 4 spaces, show tabs as four spaces, expand
> > tabs) - doesn't that cover everyone? :-)
> >
> > Oh wait, apparently there are new forms of heresy in the editor
> > wars.
>
> To avoid editor war, I propose to introduce
>
> use warnings, FATAL => 'indented-tab';

VETO

I for one don't care about mixing white space in indentation at all.
I seriously don;t see why people fight wars about it. My editor deals
with it the way it was meant to so I don't "see" a difference so I
don't care. I'll put my energy in real problems.

If however my scripts suddenly start to fail because of leading
whitespace that has *absolutely nothing* to do with the code at hand
(we're not python or yaml where indentation matters) I'd be most
distressed, as I cannot see why the code is wrong: my editor doesn't
show the diff and I don't care.

This is for perl-tidy or perl-lint or whatever tidier or beautifier you
happen to use, but certainly not for runtime failures.

> ...and make it default in v7.1

NOT EVER

> Before that - we need to stuff this line into every single "*.p[ml]"
> and *.t file. Name it next modernization step.
> This is our string point: deprecating "threads" and stuffing "use
> warnings" everywhere.
>
> This is feasible: python3 issues an error for indentation tabs.
> Can we learn from python on this?

No. Perl has freedom.

Of course it is important to be as consistent as possible, so please
use the style of the file you are editing, however difficult or
counterintuitive it is. I know. Been there done that. "fixing" it to
please everybody is impossible. (I've seen people "fix" complete
projects by expanding leading tabs to spaces forgetting some of the
files might be (sources for) makefile(s) and thus breaking everything.

/me returns to his cave

--
H.Merijn Brand https://tux.nl Perl Monger http://amsterdam.pm.org/
using perl5.00307 .. 5.33 porting perl5 on HP-UX, AIX, and Linux
https://tux.nl/email.html http://qa.perl.org https://www.test-smoke.org
Re: Tab indentation to space indentation pull requests [ In reply to ]
To avoid editor war, I propose to introduce
>
> use warnings, FATAL => 'indented-tab';
>
> ...and make it default in v7.1
>
>
do not enforce someone's preferred idea.

Regarding tabs vs spaces, editor wars and such things ... any decision in
this field is decision to preserve past (except for emacs and vi, those are
time invariants)
Re: Tab indentation to space indentation pull requests [ In reply to ]
it (.editorconfig[1] file) is already added to the tree as part of a pull
request[2]

one needs to install plugin (eg. package on emacs) to set it up (ie. to
recognize the existing file automatically by the editor in question)


[1]: https://www.github.com/Perl/perl5/tree/blead/.editorconfig

[2]: https://github.com/Perl/perl5/pull/18447




On Mon, Apr 12, 2021, 16:31 Nicholas Clark <nick@ccl4.org> wrote:

> On Mon, Apr 12, 2021 at 12:25:07PM +0000, Konovalov, Vadim wrote:
> > > > the indentation breaks down in my editor.
> > >
> > > Not only yours, mine too. Sometime it's "impossible" to read the
> written.
> >
> > ...then you need a better editor
> > (c) Larry Wall
>
> But we have editor blocks for vi and emacs to set things up correctly
> (ie indent at 4 spaces, show tabs as four spaces, expand tabs) - doesn't
> that cover everyone? :-)
>
> Oh wait, apparently there are new forms of heresy in the editor wars.
>
> I am aware of https://editorconfig.org/
>
> I am not familiar with how to set it up (because I have not needed to)
>
> But I don't see an .editorconfig file.
>
> Is it viable to add one that tells the entire pantheon of editors how to
> render the indenting sensibly?
>
> Nicholas Clark
>
Re: Tab indentation to space indentation pull requests [ In reply to ]
On Mon, Apr 12, 2021 at 5:44 AM Konovalov, Vadim <Vadim.Konovalov@dell.com>
wrote:

> To avoid editor war, I propose to introduce
>
> use warnings, FATAL => 'indented-tab';
>
> ...and make it default in v7.1
>

IMHO, if you wish to enforce a particular indentation paradigm, you should
do so with tests (see Test::NoTabs and its related Dist::Zilla plugin;
there are also other modules for other types of indentation), or with a
perlcritic policy. It is not appropriate to do so in the core language
itself.
Re: Tab indentation to space indentation pull requests [ In reply to ]
On 4/12/21 10:24 AM, rwp _ wrote:
> it (.editorconfig[1] file) is already added to the tree as part of a
> pull request[2]
>
> one needs to install plugin (eg. package on emacs) to set it up (ie. to
> recognize the existing file automatically by the editor in question)
>
>
> [1]: https://www.github.com/Perl/perl5/tree/blead/.editorconfig
> <https://www.github.com/Perl/perl5/tree/blead/.editorconfig>
>
> [2]: https://github.com/Perl/perl5/pull/18447
> <https://github.com/Perl/perl5/pull/18447>
>
>

The official policy is no new tabs in perl source, except when needed
for special purposes. This decision was made at the time that those
editor hints lines were added to the files.

The hope was that the editors would gradually replace existing tabs as
lines got edited, but I know that my vim doesn't always do so.
Re: Tab indentation to space indentation pull requests [ In reply to ]
??????

I am very confused.

Which topic is this thread talking about?

1. Perl CORE C source and Perl source

2. User Perl Source

2021?4?12?(?) 7:08 ?????? ???????? <mchlkzch@gmail.com>:

> In pod/perlhack.pod there are such lines:
>
> > =head3 Style
> >
> > In general, please follow the particular style of the code you are
> > patching.
> >
> > In particular, follow these general guidelines for patching Perl
> > sources:
> >
> > =over 4
> >
> > =item *
> >
> > 4-wide indents for code, 2-wide indents for nested CPP C<#define>s,
> > with 8-wide tabstops.
> >
> > =item *
> >
> > Use spaces for indentation, not tab characters.
> >
> > The codebase is a mixture of tabs and spaces for indentation, and we
> > are moving to spaces only. Converting lines you're patching from 8-wide
> > tabs to spaces will help this migration.
>
> Is it acceptable to create pull-requests just for such tab/spaces
> substitutions? If yes for which files the answer is no and why?
>
Re: Tab indentation to space indentation pull requests [ In reply to ]
#1

On Mon, Apr 12, 2021 at 7:54 PM Yuki Kimoto <kimoto.yuki@gmail.com> wrote:

> ??????
>
> I am very confused.
>
> Which topic is this thread talking about?
>
> 1. Perl CORE C source and Perl source
>
> 2. User Perl Source
>
> 2021?4?12?(?) 7:08 ?????? ???????? <mchlkzch@gmail.com>:
>
>> In pod/perlhack.pod there are such lines:
>>
>> > =head3 Style
>> >
>> > In general, please follow the particular style of the code you are
>> > patching.
>> >
>> > In particular, follow these general guidelines for patching Perl
>> > sources:
>> >
>> > =over 4
>> >
>> > =item *
>> >
>> > 4-wide indents for code, 2-wide indents for nested CPP C<#define>s,
>> > with 8-wide tabstops.
>> >
>> > =item *
>> >
>> > Use spaces for indentation, not tab characters.
>> >
>> > The codebase is a mixture of tabs and spaces for indentation, and we
>> > are moving to spaces only. Converting lines you're patching from 8-wide
>> > tabs to spaces will help this migration.
>>
>> Is it acceptable to create pull-requests just for such tab/spaces
>> substitutions? If yes for which files the answer is no and why?
>>
>
RE: Tab indentation to space indentation pull requests [ In reply to ]
> From: H.Merijn Brand
> On Mon, 12 Apr 2021 12:43:49 +0000, "Konovalov, Vadim" wrote:
> > use warnings, FATAL => 'indented-tab';
>
> VETO
>
> > ...and make it default in v7.1
>
> NOT EVER

It was sarcasm from my side.

Sorry
Re: Tab indentation to space indentation pull requests [ In reply to ]
>>>>> On Tue, 13 Apr 2021 06:36:08 +0000, "Konovalov, Vadim" <Vadim.Konovalov@dell.com> said:

>> From: H.Merijn Brand
>> On Mon, 12 Apr 2021 12:43:49 +0000, "Konovalov, Vadim" wrote:
>> > use warnings, FATAL => 'indented-tab';
>>
>> VETO
>>
>> > ...and make it default in v7.1
>>
>> NOT EVER

> It was sarcasm from my side.

> Sorry

LOL. Well done!

:)))
--
andreas
Re: Tab indentation to space indentation pull requests [ In reply to ]
On Tue, 13 Apr 2021 08:36:08 +0200, Konovalov, Vadim <Vadim.Konovalov@dell.com> wrote:

>> From: H.Merijn Brand
>> On Mon, 12 Apr 2021 12:43:49 +0000, "Konovalov, Vadim" wrote:
>> > use warnings, FATAL => 'indented-tab';
>>
>> VETO
>>
>> > ...and make it default in v7.1
>>
>> NOT EVER
>
> It was sarcasm from my side.
>
> Sorry

aw man, i was excited :D

--
With regards,
Christian Walde
Re: Tab indentation to space indentation pull requests [ In reply to ]
On 4/13/21 5:59 AM, Andreas Koenig wrote:
>>>>>> On Tue, 13 Apr 2021 06:36:08 +0000, "Konovalov, Vadim" <Vadim.Konovalov@dell.com> said:
>
> >> From: H.Merijn Brand
> >> On Mon, 12 Apr 2021 12:43:49 +0000, "Konovalov, Vadim" wrote:
> >> > use warnings, FATAL => 'indented-tab';
> >>
> >> VETO
> >>
> >> > ...and make it default in v7.1
> >>
> >> NOT EVER
>
> > It was sarcasm from my side.
>
> > Sorry
>
> LOL. Well done!
>
> :)))
>

Well fighting over something is the first step towards acceptance, even
if it's pretend.

Brett xD
Re: Tab indentation to space indentation pull requests [ In reply to ]
Konovalov

Oh, It was a joke.

I'm not a native English speaker, so maybe I didn't understand.






2021?4?13?(?) 15:36 Konovalov, Vadim <Vadim.Konovalov@dell.com>:

> > From: H.Merijn Brand
> > On Mon, 12 Apr 2021 12:43:49 +0000, "Konovalov, Vadim" wrote:
> > > use warnings, FATAL => 'indented-tab';
> >
> > VETO
> >
> > > ...and make it default in v7.1
> >
> > NOT EVER
>
> It was sarcasm from my side.
>
> Sorry
>
>
Re: Tab indentation to space indentation pull requests [ In reply to ]
On 4/13/2021 4:51 PM, Yuki Kimoto wrote:
> Konovalov
>
> Oh, It was a joke.
>
> I'm not a native English speaker, so maybe I didn't understand.
>

I am a native English speaker, and I didn't get it either.

But to come to think of it; I actually think this is a good idea, if we
spelled it

use python;
>
>
>
>
> 2021?4?13?(?) 15:36 Konovalov, Vadim <Vadim.Konovalov@dell.com
> <mailto:Vadim.Konovalov@dell.com>>:
>
> > From: H.Merijn Brand
> > On Mon, 12 Apr 2021 12:43:49 +0000, "Konovalov, Vadim" wrote:
> > >   use warnings, FATAL => 'indented-tab';
> >
> > VETO
> >
> > > ...and make it default in v7.1
> >
> > NOT EVER
>
> It was sarcasm from my side.
>
> Sorry
>
Re: Tab indentation to space indentation pull requests [ In reply to ]
On 4/13/21 6:56 PM, Karl Williamson wrote:
> On 4/13/2021 4:51 PM, Yuki Kimoto wrote:
>> Konovalov
>>
>> Oh, It was a joke.
>>
>> I'm not a native English speaker, so maybe I didn't understand.
>>
>
> I am a native English speaker, and I didn't get it either.
>
> But to come to think of it; I actually think this is a good idea, if we
> spelled it
>
>     use python;
>>

Can it fail 99% of its tests and skip the others on the smokers like
PHP::Strings?

We're joking around right? I am assuming so. xD

Brett

>>
>>
>>
>> 2021?4?13?(?) 15:36 Konovalov, Vadim <Vadim.Konovalov@dell.com
>> <mailto:Vadim.Konovalov@dell.com>>:
>>
>>      > From: H.Merijn Brand
>>      > On Mon, 12 Apr 2021 12:43:49 +0000, "Konovalov, Vadim" wrote:
>>      > >   use warnings, FATAL => 'indented-tab';
>>      >
>>      > VETO
>>      >
>>      > > ...and make it default in v7.1
>>      >
>>      > NOT EVER
>>
>>     It was sarcasm from my side.
>>
>>     Sorry
>>
>