Outlaw tabs

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
18 messages Options
Reply | Threaded
Open this post in threaded view
|

Outlaw tabs

Achim Schneider
I guess everyone knows why.

--
(c) this sig last receiving data processing entity. Inspect headers
for copyright history. All rights reserved. Copying, hiring, renting,
performance and/or quoting of this signature prohibited.


_______________________________________________
Haskell-prime mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-prime
Reply | Threaded
Open this post in threaded view
|

Re: Outlaw tabs

Don Stewart-2
barsoap:
> I guess everyone knows why.

Use -Wwarn-tabs
_______________________________________________
Haskell-prime mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-prime
Reply | Threaded
Open this post in threaded view
|

Re: Outlaw tabs

Dave Bayer

On Jan 23, 2009, at 7:17 PM, Don Stewart wrote:

> barsoap:
>> I guess everyone knows why.
>
> Use -Wwarn-tabs

It's -fwarn-tabs

_______________________________________________
Haskell-prime mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-prime
Reply | Threaded
Open this post in threaded view
|

Re: Outlaw tabs

Achim Schneider
Dave Bayer <[hidden email]>
wrote:

>
> On Jan 23, 2009, at 7:17 PM, Don Stewart wrote:
>
> > barsoap:
> >> I guess everyone knows why.
> >
> > Use -Wwarn-tabs
>
> It's -fwarn-tabs
>
I use :set et, always and ever, I don't need to. Think of all those
newbies being stuck with strange type errors... Doesn't anyone think of
the newbies? ;)

--
(c) this sig last receiving data processing entity. Inspect headers
for copyright history. All rights reserved. Copying, hiring, renting,
performance and/or quoting of this signature prohibited.


_______________________________________________
Haskell-prime mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-prime
Reply | Threaded
Open this post in threaded view
|

Re: Outlaw tabs

Jon Fairbairn
In reply to this post by Don Stewart-2
Don Stewart <[hidden email]> writes:

> barsoap:
>> I guess everyone knows why.
>
> Use -Wwarn-tabs

Warnings are the wrong answer to this problem.  In fact,
they're rarely the right answer to any problem. Tabs in
sourcecode can have bad effects, and Haskell is a language
that attempts to reject bad effects as far as possible. Nor
can I see any argument in favour of allowing tabs (if HT is
allowed, why not VT?).

--
Jón Fairbairn                                 [hidden email]

_______________________________________________
Haskell-prime mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-prime
Reply | Threaded
Open this post in threaded view
|

Re: Outlaw tabs

Duncan Coutts
In reply to this post by Achim Schneider
On Sat, 2009-01-24 at 00:35 +0100, Achim Schneider wrote:
> I guess everyone knows why.

Can I recommend Ian's Good Haskell Style

http://urchin.earth.li/~ian/style/haskell.html

We should have it linked/published more widely. The Vim mode that it
links to is also excellent. We should try and get it ported to the
Haskell emacs mode.

As others have also pointed out adding ghc-options: -fwarn-tabs to a
project .cabal file is a good way to stop them creeping back in.

A lot of projects use -Wall. If there is consensus on the tabs issue
then we could ask for -fwarn-tabs to be included in -Wall. That should
be a good first step. If we cannot achieve consensus within the
community for having -Wall include -fwarn-tabs then we have no hope of
banning them in the language definition.

So lets first test test the waters on that proposal.

Duncan

_______________________________________________
Haskell-prime mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-prime
Reply | Threaded
Open this post in threaded view
|

Re: Outlaw tabs

Cale Gibbard
2009/1/24 Duncan Coutts <[hidden email]>:
> A lot of projects use -Wall. If there is consensus on the tabs issue
> then we could ask for -fwarn-tabs to be included in -Wall. That should
> be a good first step. If we cannot achieve consensus within the
> community for having -Wall include -fwarn-tabs then we have no hope of
> banning them in the language definition.
>
> So lets first test test the waters on that proposal.
>
> Duncan

+1 for treating tab characters outside comments as a lexical error,
and of course if you'd like to add -fwarn-tabs to -Wall first that
would be fine with me.

 - Cale
_______________________________________________
Haskell-prime mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-prime
Reply | Threaded
Open this post in threaded view
|

Re: Outlaw tabs

Lennart Augustsson
In reply to this post by Jon Fairbairn
But VT is allowed in Haskell.

On Sat, Jan 24, 2009 at 10:50 AM, Jon Fairbairn
<[hidden email]> wrote:

> Don Stewart <[hidden email]> writes:
>
>> barsoap:
>>> I guess everyone knows why.
>>
>> Use -Wwarn-tabs
>
> Warnings are the wrong answer to this problem.  In fact,
> they're rarely the right answer to any problem. Tabs in
> sourcecode can have bad effects, and Haskell is a language
> that attempts to reject bad effects as far as possible. Nor
> can I see any argument in favour of allowing tabs (if HT is
> allowed, why not VT?).
>
> --
> Jón Fairbairn                                 [hidden email]
>
> _______________________________________________
> Haskell-prime mailing list
> [hidden email]
> http://www.haskell.org/mailman/listinfo/haskell-prime
>
_______________________________________________
Haskell-prime mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-prime
Reply | Threaded
Open this post in threaded view
|

Re: Outlaw tabs

Jon Fairbairn
Lennart Augustsson <[hidden email]> writes:

> But VT is allowed in Haskell.

Gosh, so it is. It's been a while since I looked, and I've
no recollection of the discussion that made it part of
whitechar. But does it mean what I want it to mean?  Does
anyone actually use it? Are there any occurrences of it in
Haskell programmes that aren't mistakes?

--
Jón Fairbairn                                 [hidden email]
http://www.chaos.org.uk/~jf/Stuff-I-dont-want.html  (updated 2008-04-26)

_______________________________________________
Haskell-prime mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-prime
Reply | Threaded
Open this post in threaded view
|

Re: Outlaw tabs

Lennart Augustsson
I don't know what you want it to mean, so I can't answer that. :)
I doubt anyone has ever used a VT on purpose.  I know I haven't.
I regard it as a lexical quirk.

  -- Lennart

On Sun, Jan 25, 2009 at 11:07 AM, Jon Fairbairn
<[hidden email]> wrote:

> Lennart Augustsson <[hidden email]> writes:
>
>> But VT is allowed in Haskell.
>
> Gosh, so it is. It's been a while since I looked, and I've
> no recollection of the discussion that made it part of
> whitechar. But does it mean what I want it to mean?  Does
> anyone actually use it? Are there any occurrences of it in
> Haskell programmes that aren't mistakes?
>
> --
> Jón Fairbairn                                 [hidden email]
> http://www.chaos.org.uk/~jf/Stuff-I-dont-want.html  (updated 2008-04-26)
>
> _______________________________________________
> Haskell-prime mailing list
> [hidden email]
> http://www.haskell.org/mailman/listinfo/haskell-prime
>
_______________________________________________
Haskell-prime mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-prime
Reply | Threaded
Open this post in threaded view
|

Re: Outlaw tabs

Jon Fairbairn
Lennart Augustsson <[hidden email]> writes:

> I don't know what you want it to mean, so I can't answer that. :)

I'm not saying, either ;-P

> I doubt anyone has ever used a VT on purpose.  I know I
> haven't.  I regard it as a lexical quirk.

Say no to quirks.

--
Jón Fairbairn                                 [hidden email]


_______________________________________________
Haskell-prime mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-prime
Reply | Threaded
Open this post in threaded view
|

Re: Outlaw tabs

Twan van Laarhoven
In reply to this post by Jon Fairbairn
Jon Fairbairn wrote:
> Warnings are the wrong answer to this problem.  In fact,
> they're rarely the right answer to any problem. Tabs in
> sourcecode can have bad effects, and Haskell is a language
> that attempts to reject bad effects as far as possible. Nor
> can I see any argument in favour of allowing tabs (if HT is
> allowed, why not VT?).

Tabs can be convenient for quick scripts and things like that, where you
wouldn't use -Wall. And while I keep hearing about the problems with tabs, I
have never encountered any with Haskell code.

There are other things that are currently warnings that come up much more often
and usually have much more severe consequences, such as name shadowing.

Twan
_______________________________________________
Haskell-prime mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-prime
Reply | Threaded
Open this post in threaded view
|

Re: Outlaw tabs

Achim Schneider
Twan van Laarhoven <[hidden email]>
wrote:

> Jon Fairbairn wrote:
> > Warnings are the wrong answer to this problem.  In fact,
> > they're rarely the right answer to any problem. Tabs in
> > sourcecode can have bad effects, and Haskell is a language
> > that attempts to reject bad effects as far as possible. Nor
> > can I see any argument in favour of allowing tabs (if HT is
> > allowed, why not VT?).
>
> Tabs can be convenient for quick scripts and things like that, where
> you wouldn't use -Wall. And while I keep hearing about the problems
> with tabs, I have never encountered any with Haskell code.
>
I don't understand how tabs in your code can be convenient for quick
scripts, considering that you'd have to switch your editor from sane
behaviour, that is expanding them to a number of spaces suitable to
your taste, to zomg-I-have-to-waste-space-on-8-space-tabs to prevent
any problems with Haskell code.

But that's all beside the point. Tabs are a reminiscence of early
typewriters used to layout tables that made their way onto early text
terminals and onto modern PC's. I don't really understand why, as
they have been and always will be obsolete and problematic on
everything but a mechanical typewriter.

It's not just Haskell code, or generally layout-rule syntax, but any
syntax: Did you ever have a look at a mixed tab/space-indent C file
with another tab width setting than the original author? Sure, {}'s
will help you along, but not before your eyes exploded.

If you want a table, use latex or a spreadsheet: Don't use a typewriter.
If you want to indent your code, use spaces so everyone sees the same
code and does not have to stick indents to tab stops.

If you want a key to quickly indent your code, use that funky key with
those two arrows, but don't let it produce a tab character while you're
editing text. Preferably, let it analyse the syntax of the previous line
and automagically Indent By The Right Amount.

Finally, for great profit, remove \t out of your ASCII table. There
would be less wars.

--
(c) this sig last receiving data processing entity. Inspect headers
for copyright history. All rights reserved. Copying, hiring, renting,
performance and/or quoting of this signature prohibited.


_______________________________________________
Haskell-prime mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-prime
Reply | Threaded
Open this post in threaded view
|

Re: Outlaw tabs

Peter Hercek-2
In reply to this post by Achim Schneider
Looks like some people still like tabs.

I personally do not mind them in my source code if the leading isSpace
characters on lines are everywhere of the same kind in one source file.
If all indentations would be done only with tabs then one can easily
change the indent size for whole file. If monitor is big enough a bigger
indent size is nicer (easier to see what is indented together). If
monitor is smaller then smaller indent size is better (lines will not
wrap so early).

If somebody uses proportional fonts then he would like to have tabs
available since there would be too much spaces to achieve any reasonable
indenting. I can imagine writing in a proportional font myself since I'm
indenting only the starts of lines and I'm not indenting anything after
the first non-isSpace character. Any indenting after the first
non-isSpace character is a pain since it makes small localized changes
to look like big changes in diffs and vcs systems and it requires an
effort to maintain it.

That said, I use non-proportional font and ban tabs in text editor,
simply because editor setups for banning tabs are readily available. But
I would probably use only tabs (but probably not proportional font) if
such editor setups would be ready. The difference is not enough for me
to configure editor myself either way.

What I want to say is that tabs are not bad, mixing tabs and spaces is
bad. And this mixing should be banned if you care about this at all when
-fwarn-tabs is available.

I would not mind banning tabs as an acceptable solution too.

Heh, too much keystrokes for the smallest problem of Haskell' :)

Peter.

Achim Schneider wrote:
> I guess everyone knows why

_______________________________________________
Haskell-prime mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-prime
Reply | Threaded
Open this post in threaded view
|

Re: Outlaw tabs

Johan Tibell-2
On Mon, Jan 26, 2009 at 9:57 AM, Peter Hercek <[hidden email]> wrote:
> I personally do not mind them in my source code if the leading isSpace
> characters on lines are everywhere of the same kind in one source file. If
> all indentations would be done only with tabs then one can easily change the
> indent size for whole file. If monitor is big enough a bigger indent size is
> nicer (easier to see what is indented together). If monitor is smaller then
> smaller indent size is better (lines will not wrap so early).

I do for the following reason: If you use only tabs for leading
whitespace you loose the ability to align things. Here's and example
using a list (view using a fixed width font):

lst = [1, 2, 3
       4, 5, 6]

This definition uses alignment to align the first element on the first
line with the first element of the second line. You can't do this kind
of alignment using tabs.

Cheers,

Johan
_______________________________________________
Haskell-prime mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-prime
Reply | Threaded
Open this post in threaded view
|

Re: Outlaw tabs

Jon Fairbairn
In reply to this post by Achim Schneider
Achim Schneider <[hidden email]> writes:

> Twan van Laarhoven <[hidden email]>
> wrote:
>> Tabs can be convenient for quick scripts and things like that, where
>> you wouldn't use -Wall. And while I keep hearing about the problems
>> with tabs, I have never encountered any with Haskell code.
>>

> If you want a key to quickly indent your code, use that funky key with
> those two arrows, but don't let it produce a tab character while you're
> editing text. Preferably, let it analyse the syntax of the previous line
> and automagically Indent By The Right Amount.

Exactly. There's no reason that convenience of input should
be part of the language syntax.  It's a job for another
component.

--
Jón Fairbairn                                 [hidden email]


_______________________________________________
Haskell-prime mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-prime
Reply | Threaded
Open this post in threaded view
|

Re: Outlaw tabs

Peter Hercek-2
In reply to this post by Johan Tibell-2
Johan Tibell wrote:

> I do for the following reason: If you use only tabs for leading
> whitespace you loose the ability to align things. Here's and example
> using a list (view using a fixed width font):
>
> lst = [1, 2, 3
>        4, 5, 6]
>
> This definition uses alignment to align the first element on the first
> line with the first element of the second line. You can't do this kind
> of alignment using tabs.

Yes, most people use that style or its variations (e.g. when multiple
assignments have the equal sign aligned somewhere in the middle of a
line or comments are aligned at the end, etc). I do not because when I
rename lst to myLst then I need to modify two lines (the second one to
fix the alignment). Also I do not like that the change looks bigger in a
text diff. I prefer:

lst = [1, 2, 3
   4, 5, 6]  -- fixed indent by two spaces regardless of previous lines

Or, if I really care about alignment at such a low level (which I almost
never do):

lst =
   [1 ,2 ,3   -- fixed indent by two spaces
   ,4 ,5 ,6]  -- fixed indent by two spaces

For your style spaces are the only way to go, what I'm perfectly fine
with. Actually whatever way this is resolved, I do not care. Just wanted
to point out that there is a use for tabs at the line start ... now
thinking it might have been an error :-)

Peter.

_______________________________________________
Haskell-prime mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-prime
Reply | Threaded
Open this post in threaded view
|

Re: Outlaw tabs

Ashley Yakeley
In reply to this post by Duncan Coutts
Duncan Coutts wrote:
 > If there is consensus on the tabs issue
 > then we could ask for -fwarn-tabs to be included in -Wall.

Does -fwarn-tabs complain about tabs in "{;}"-style? It should not.

--
Ashley Yakeley

_______________________________________________
Haskell-prime mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-prime