
How to Solve Tabs vs. Spaces Forever - ingve
http://inessential.com/2015/12/21/how_to_solve_tabs_vs_spaces_forever
======
stevebmark
I'm all for concise writing, but explaining the term "outliner" and "tree
structure editor" would greatly improve this post.

~~~
isxek
Agreed. I initially thought he was referring to editors like Leo
([http://leoeditor.com/](http://leoeditor.com/)) or Code Browser
([http://tibleiz.net/code-browser/](http://tibleiz.net/code-browser/)), but
now I'm not sure.

------
daemin
This is like the idea of storing the code in a richer file format rather than
just text. It would be up to the editor to format it and present it
appropriately. This would also allow for code comments, pre-post checks,
assertions, and other metadata to be embedded into the code without having to
be typed in some meta language or language extensions in the plain text.

I would like to experiment with something like that but given how much
existing plain text code there is I don't see this happening any time soon.

~~~
mchahn
> but given how much existing plain text code there is I don't see this
> happening any time soon.

But this could work with existing code through simple translation. It could
even possibly be converted to an outline when read into the outline-based
editor and then be rewritten as plain text when saved.

I have worked on a scheme that makes ES6 look like coffeescript when in the
editor while stored as normal javascript on the disk. This would solve the
problem of working in (almost) Coffeescript on someone else's project written
in Javascript. I'm stuck right now because I can't get the number of changed
lines in GIT down to an acceptable level. See [https://github.com/mark-
hahn/jsw](https://github.com/mark-hahn/jsw).

~~~
daemin
It could, but the goal would be to store the code as rich text not plain text.
So it would have to be decomposed to an AST and then stored in some structured
format - XML for example.

This means that all of these existing tools that deal with just plain text
would need modifications to handle the richer file format.

Having it as rich text in the editor and then saving it out as a plain text
file means you're just making a rich code editor.

------
joshka
The plain text to outlined code is pretty much what a compiler does. The
proposal is akin to the idea of editing code as an AST rather than a textual
representation. Until our source control software supports the idea of seeing
code files as more than just lines of text, this idea is likely to go nowhere
IMO.

It would be neat to see this in a RCS though. Imagine seeing a diff like:

    
    
       renamed foo() to bar()
       bar() changes:
       + if (baz) { ... }
       - if (quux) { ...}

------
oneeyedpigeon
Is there a reasonable use-case for folding the contents of an if-block? I
would love a truly syntax-aware editor and RCS, though.

~~~
davelnewton
Wanting to focus on things that are not the contents of the if-block.

------
teilo
Every IDE I have ever seen has code folding and auto-indentation. Including
Xcode. This is a solution looking for a problem.

~~~
stcredzero
I think of it more as a demonstration of a general principle. There's no
reason why we shouldn't abandon flat text files. Some huge fraction of
development shops aren't really coding in flat text files anymore -- the IDE
being completely essential to the shop's process at this point. Many IDEs have
to basically parse the source to develop live objects to have their full
capability, anyhow. Environments like Smalltalk have been operating without
source files for decades now. Instead of source files as we know them, you
basically have textual transaction logs for changing the source code database.
This even makes the system more powerful, flexible, and robust thank
traditional text files.

------
nikdaheratik
The biggest argument against this is future proofing development. Even if your
tools change and/or are lost, plain text will live on. Your special formatting
or behind the scenes gymnastics to make the text look okay, may not.

------
Terr_
IMO the best practical compromise is:

1\. Edit it with an IDE that supports soft-tabs.

2\. Save the actual text-file with spaces, for explicit positioning and
uniform appearance.

------
edoceo
Just use tabs :p

~~~
voidz
Yeah.

And conversely, if anyone makes the argument of "How to Solve Spaces vs. Tabs
Forever", tell them to just use spaces. Problems solved!

If only we could.

