The argument isn't very interesting, intent is much more so. It all
comes from one guy who figured a way to troll everyone alive at the time
plus all future generations forever, and succeeded.
--
Loïc Hoguin
http://ninenines.eu
Actually the solution to this age old debate was proposed to me by a friend of mine and its genius on a number of levels but isn't implemented anywhere. The reality is that for most languages whitespace is irrelevant so it shouldn't be the code holding the indentation but the user's preference file. Imagine a source code repository where there is NO irrelevant whitespace in the code base. For java, for example, there would be literally only one single line of code. Now when you check out you have a preference file that says you want tabs or spaces or mixed and also defines the other formatting you prefer. When you check out the system reformats the code according to your specs dynamically. When you commit, it strips your code of whitespace before comparing.Now that would rock. Not just for tabs but the other code holy wars like drop braces and so onlRobert Simmons Jr. MSc. - Lead Java Architect @ EAAuthor of: Hardcore Java (2003) and Maintainable Java (2012)
Code is text, so keep it readable without requiring any special crappy
editor.
On 02/05/2014 09:21 PM, kraythe . wrote:
> Actually the solution to this age old debate was proposed to me by a
> friend of mine and its genius on a number of levels but isn't
> implemented anywhere. The reality is that for most languages whitespace
> is irrelevant so it shouldn't be the code holding the indentation but
> the user's preference file. Imagine a source code repository where there
> is NO irrelevant whitespace in the code base. For java, for example,
> there would be literally only one single line of code. Now when you
> check out you have a preference file that says you want tabs or spaces
> or mixed and also defines the other formatting you prefer. When you
> check out the system reformats the code according to your specs
> dynamically. When you commit, it strips your code of whitespace before
> comparing.
>
> Now that would rock. Not just for tabs but the other code holy wars like
> drop braces and so onl
>
> *Robert Simmons Jr. MSc. - Lead Java Architect @ EA*
> /Author of: Hardcore Java (2003) and Maintainable Java (2012)/
> /LinkedIn: //http://www.linkedin.com/pub/robert-simmons/40/852/a39/
>
>
> On Wed, Feb 5, 2014 at 2:21 PM, kraythe . <kra...@gmail.com
> <mailto:kra...@gmail.com>> wrote:
>
> Actually the solution to this age old debate was proposed to me by a
> friend of mine and its genius on a number of levels but isn't
> implemented anywhere. The reality is that for most languages
> whitespace is irrelevant so it shouldn't be the code holding the
> indentation but the user's preference file. Imagine a source code
> repository where there is NO irrelevant whitespace in the code base.
> For java, for example, there would be literally only one single line
> of code. Now when you check out you have a preference file that says
> you want tabs or spaces or mixed and also defines the other
> formatting you prefer. When you check out the system reformats the
> code according to your specs dynamically. When you commit, it strips
> your code of whitespace before comparing.
>
> Now that would rock. Not just for tabs but the other code holy wars
> like drop braces and so onl
>
> *Robert Simmons Jr. MSc. - Lead Java Architect @ EA*
> /Author of: Hardcore Java (2003) and Maintainable Java (2012)/
> /LinkedIn: //http://www.linkedin.com/pub/robert-simmons/40/852/a39/
> erlang-q...@erlang.org <mailto:erlang-q...@erlang.org>
> http://erlang.org/mailman/listinfo/erlang-questions
>
>
>
>
>
> _______________________________________________
> erlang-questions mailing list
> erlang-q...@erlang.org
> http://erlang.org/mailman/listinfo/erlang-questions
>
--
Loïc Hoguin
http://ninenines.eu
???
There is no evil, this is at most a minor annoyance that comes with
pointless debates shrouded by blind religious beliefs.
The answer is always "submit code the way the project owner wants you
to" and no amount of debating is going to change that, ever.
It's not even just tabs vs spaces, plenty other minor things are the
author's choice, including number of columns, newline characters, source
code encoding, but also major things like mandatory documentation or
tests and backward compatibility.
There is no one true way of doing things, for this or for anything else.
It's just a matter of choice.
--
Loïc Hoguin
http://ninenines.eu
This seems like a problem that can be confined to the OTP team and
process, which is I think is a pretty small subset of all erlang-mode
users, no? And changing erlang-mode to default to spaces doesn't make
this worse does it?
Have you read the previous threads? Numerous solutions were posted.
Here's a quick one for vim users:
http://erlang.org/pipermail/erlang-questions/2009-February/041719.html
And even better if you want it to also look good and close enough to get
your patch accepted:
http://stackoverflow.com/questions/4085411/vim-indent-like-emacs
(Values may be slightly different for erlang-mode, I don't have this
configured yet on this laptop.)
You can even use direnv to set an alias only for the erlang/otp folder
on your machine that would use a special configuration file that
includes those settings, so that you don't have to worry about it at
all. (And if you don't like the direnv solution, there's a few others,
including ones that only require vim.)
--
Loïc Hoguin
http://ninenines.eu
These are opinions, not facts.
The editors I use have a way to change the size of a tabstop. The word
processors I use have a way to change the size of each tabstop level. If
8 was the correct number these possibilities would not be present.
bengt
On Wed, 2014-02-05 at 22:58 +0100, Anthony Ramine wrote:
> Hello Vlad,
>
> My strategy with regard to indentation is to just expand all tabs on all the lines I edit or add to the code. And I just absolutely don’t care about it not being consistent with the mixed tabs and spaces around it.
>
> With a correct tabstop (8 and only 8), it doesn’t matter anyway.
>
> Regards,
>
_______________________________________________
Plus this doesn't help your code get merged at all. If you submit code
with broken whitespace, then tools will also display this whitespace
change. You can of course hide whitespace changes, but the problem is
that whitespace does matter in some places, so you're basically hiding
potentially important information by doing that.
I also highly doubt that "the owner would be able to accept more code".
Like I said before, this is a minor annoyance at best.
He wouldn't appear nicer either, because he has to spend extra time on
each PR, meaning they get merged slower, which is a bigger annoyance
than telling people to fix the whitespace they broke.
The contributor can quickly see if they broke whitespace after
submitting the PR on github by looking at the diff tab. I'm always
surprised when people submit a PR with obviously broken whitespace and
do nothing about it until I point it out.
Contributors aren't the ones who are going to maintain the code. They
just write and forget. Therefore they should be the ones who make sure
that what they submit is well-formed so as to not become an
inconvenience to the project owner, who is going to maintain their code
for them for free.
--
Loïc Hoguin
http://ninenines.eu
These are my opinions, not facts.
Thank you for the feedback. Hopefully the new version makes things
clearer. If not, please do not hesitate to help me make it better.
The opinions statement that I start my email with has become necessary
since some people on erlang-questions explained in a belligerent way
that they had previously never seen opinions expressed as something that
might be mistaken for facts. They surely where from a part of the
Internet that I have never seen, but it takes only a little sentence to
make them happy.
bengt
Plus this doesn't help your code get merged at all. If you submit code with broken whitespace, then tools will also display this whitespace change. You can of course hide whitespace changes, but the problem is that whitespace does matter in some places, so you're basically hiding potentially important information by doing that.
On Thu, Feb 6, 2014 at 9:38 AM, Loïc Hoguin <es...@ninenines.eu> wrote:As an interesting anecdote, yesterday I managed somehow to produce a
> The contributor can quickly see if they broke whitespace after submitting
> the PR on github by looking at the diff tab. I'm always surprised when
> people submit a PR with obviously broken whitespace and do nothing about it
> until I point it out.
patch that looked good on github, but not in emacs... So unfortunately
it seems that checking GH might not be enough (at least not when not
using emacs in the first place).
Greetings,So Erlang is sensitive to indention to the point of causing bugs. I did
These are my opinions, not facts.
not know that.
On 6 Feb 2014 12:27, "Bengt Kleberg" <bengt....@ericsson.com> wrote:
>
> Greetings,
>
> These are my opinions, not facts.
>
> Does your "erl-indent" program format according to the current OTP style
> guide? It would be very good if that was the case.
It uses erlang - mode to indent. I certainly assume that it uses the style recommended by otp.
Not all otp source files are idempotent under the indentation, so it might mean that not all are following the otp style.
/vlad
Greetings,It is strange that you hate tabs when it is the tools that are doing it
These are my opinions, not facts.
wrong. Please try to not kill the messenger...
> _______________________________________________
> erlang-questions mailing list
> erlang-q...@erlang.org
> http://erlang.org/mailman/listinfo/erlang-questions
>
--
Loïc Hoguin
http://ninenines.eu
This has been a very productive thread. If I may try to summarize, for
posterity:
- Mixed tabs and spaces present challenges for programmer using
different editors and contributing to projects with varied or poorly
defined white space standards
- There are a number of possible solutions to this problem, many of
which have been mentioned here
- The cost of discussing this problem is so much higher than cost of
actually dealing with it - even in cases where a programmer has to
manually copy and past formatted lines to preserve a source file's
dark, twisted and immortal formatting - it's *still much easier* than
talking about how to fix the underlying problem
I feel a certain liberation knowing this.
These are my opinions, which are facts.
I learnt today that I hate any opinions which are facts. This is a fact.
Also if you if you missed the "not", It was attached to facts. And was
a blink. But you failed to understand it locked in your politically
correctness trap.
- benoit.
hate: a very strong feeling of dislike
This exactly what I wanted to express.
- benoit
Tabs are perfectly fine for indentation. You had issues only because you
were doing both indentation *and* alignment. If you don't align your
code, it doesn't matter what the tab length is.
Just like the CAP theorem, I posit the TIA theorem: tabs, indentation,
alignment, choose two.
--
Loïc Hoguin
http://ninenines.eu
One day not too long ago I decided to stop aligning entirely. Code is
still as readable as before, and I don't have to spend any time worrying
about prettifying the code (or fixing what the auto identation thing
did). Nobody said my code is less readable because of it so far.
I'm using tabs mostly for historical reasons, if I were to use spaces I
still wouldn't align.
--
Loïc Hoguin
http://ninenines.eu
Indentation:
myfunction(A, B, C,
D, E) ->
Alignment:
myfunction(A, B, C,
D, E) ->
But also, skipping the indentation that would be to the left of these
assignments...
No alignment:
A = 1,
Bartender = 17,
Car = 35,
Alignment:
A = 1,
Bartender = 17,
Car = 35,
Hopefully it'll show up properly in the email.
--
Loïc Hoguin
http://ninenines.eu
--
Loïc Hoguin
http://ninenines.eu
I agree. Unfortunately many people align there.
> I would write this as
>
> my_function(
> A, B, C, D, E
> ) ->
That certainly looks better.