📜 ⬆️ ⬇️

Spaces VS tabs 4. Death to all


When I noticed at work the very first topic about tabs, I thought it would be worth reading in the evening and answering. But the answer has already been written by someone . Although it did not agree with what I wanted to write, I scored on this matter.
But today I read the third topic and I can not understand one.

Why do we need tabs in code?

Why gaps? Why line breaks? Why do you need a text? Yes, yes, I myself use them both at home and at work, and I cannot live without them, but they must be abandoned. At all.

Do not we discuss about how to arrange another MVC, mVC, MVc and other variations of this three-letter architecture. Sometimes even a smartModel is obtained. Sometimes we even try to read GoF. Do not we advocate for the removal of clearance from html in css? So why the hell do we mix logic and representation in a piece of text and call it source code?

When we write code, we use lexemes, for some reason, saving them as text, and then parsing them back. Autocomplete, what is he doing? It gives us lexemes. Again. We write lexemes, the compiler reads lexemes. The text here why? Then, we just got used to it. I think that the text as the source code carrier should die like punched cards (I didn’t find them in my work, I just wrote (wrote with a ball pen) on control computers in computer science, because there were tons of unused punched cards at the local university). More information about Fortran and punch cards can be found here . Did we survive it? And we will survive the text.
')

Why do you need to stop using text?


Because it carries both logic and design at the same time. And should carry only logic. Imagine how good it would be if the source code (some binary format) contained a description of logic in the form of lexemes. And our IDE would have settings for how we want to see this code. We want Egyptian brackets, we use Egyptian brackets, we don’t want - we don’t use, it’s just a representation, and we don’t need to store it in a file with code. Someone puts curly brackets if field if there is one operation, and someone does not. This is also a representation, from the point of view of the compiler, these constructions are equivalent. But from the point of view of the programmer there, so they need to be divided. Why color design code, we can afford to keep at home and not to distribute with the text, and tabs should.

Has someone already done this? Of course.


It breaks into the topic:
Realaxy ActionScript Editor. On Habré you can read here . The official site is here . The developers have made a masterpiece. However, until I bought it because of one small problem: the style of brackets there is only Egyptian. I used all the settings during the trial period, but I did not find where it is configured. As soon as it works, I'll buy it, that very day. They are moving exactly in the direction I am talking about. Code is not text, but its presentation is set by the editor. Heap is the editor of my favorite language.

Of course, there are a number of problems when switching to this type of source code storage, in particular, it will be necessary to change the version control systems, but this is not a problem because The code is already a set of lexemes and even easier and clearer to indicate what has changed.

Such an approach will reduce the number of errors, simplify development and bring peace to lovers of tabs and spaces, make friends of the Egyptian-style lovers with its haters. Just everyone will see what he wants.

Place for the code as text in the museum, next to the punched cards.

PS I was waiting for a similar post from the developers of Realaxy, but did not wait, because this is the time to announce the advantages of the new approach. Yes, I really like ActionScript 3 and this gorgeous yellow smiley helmet, and I hate Egyptian brackets.

The photo of the museum exhibit was published under CC-BY-SA by Johnathan Nightingale .

Source: https://habr.com/ru/post/118525/


All Articles