Styler in the MetaTrader 5 trading terminal - page 6

 
Renat :

When you collect, manage and pay for the Code Base yourself, the question will immediately fall away.

No, you are laughing after all.

How does the styler relate to the base? How does a programmer's tool (which he/she uses to facilitate his/her work) relate to the rules of publication (which may have nothing to do with his/her work at all)?

You yourself said that all the codes will be automatically "combed" by the styler before publication. So let him "comb" them in your style before publication, no one is arguing about that!

Separate the concepts of "base" and "styler", and everything will fall into place.



Renat:

Or do you think that everything around here is done for free?

Renat, you are well aware that the base brings income (albeit indirectly).

And for some reason you're giving away the terminal for free too.



Renat:

Now all the talk is only about "it's bad only because it's not customizable" as a matter of principle.

Let's move on to specific points - indicate which point and why it is not done correctly by the styler.

What is wrong is not a specific action, but the approach itself.

It is unacceptable to dwell on one (whatever) style. You are not pioneers, and several different styles of programming have already been established before you. Each has its own advantages and disadvantages, and each is familiar to its user.

Choosing one option means that you automatically reject more than half of the programmers. You will not force them to retrain. Moreover, many start to write in MQL after a solid experience in programming in other languages.


The solution is simple and obvious - make customizable parameters and a few standard styles. Put yours by default, but allow to change its settings. Believe me, newbies (if you're suddenly worried that they'll start writing "wrong") will never go into these settings!


Examples of settings to list? ;)

 
Thank you, one point "how many spaces before a curly bracket" has been made. We put 2 and you put 0.


Let's move on to the next points.

 
Renat :
Thank you, one point "how many spaces before a curly bracket" is voiced. We put 2 and you put 0.


Let's move on to the next points.

  1. Spaces around = += -= *= /* -- ++ + - * /, after "(", after "," and before ")";
  2. A tab instead of 3 spaces in the indentation would be great at all.
 
Renat :

Let's move on to the next points.

Don't suffer so much. "Everything's already been stolen before us."

Take Astyle's list of items. You probably won't be inspired by the full list of uncrustify, and you probably don't have to, but it's very clear and concise - you can choose what you need.

Artistic Style
  • astyle.sourceforge.net
becomes (with break‑after‑logical):
 
komposter :
  1. Spaces around = += -= *= /* -- ++ + - * /, after "(", after "," and before ")";
  2. Tabs instead of 3 spaces in the indentation would be awesome.


on point 2: tabulation is evil - try looking at the same code in different editors... will float, to put it mildly
 
mql5 :


on point 2: tabulation is evil - try looking at the same code in different editors... will float to put it mildly
komposter:
  1. Spaces around = += -= *= /* -- ++ + - * /, after "(", after "," and before ")";
  2. Tabs instead of 3 spaces in the indentation would be awesome.


That's why you don't have to comb it in your own way. Everyone has his own cockroaches in his head. Give the people bread and circuses. We will choose for ourselves what we like.

 
mql5 :


on point 2: tabulation is evil - try looking at the same code in different editors... to put it mildly, it'll float

The solution is simple, the tab (indent) is done either by the tab character (then it may float) or by the right number of spaces (then everything will be the same everywhere).

Artistic Style
  • astyle.sourceforge.net
becomes (with break‑after‑logical):
 

The second point "separate the operations with spaces" is voiced.


Are there any other points?

 
Renat :

The second point of 'separate operations spaces' is voiced.

Any other points?


class Class
{ // скобка на уровне объявления
private: // спецификаор на уровне объявления
   // приватные типы
   definition; // объявления и определения функций и членов с отступом
  
protected:
   // защищённые типы
   definition;
public:
   // публичные типы
   definition;

public:
   definition;
  
protected:
   definition;
  
private:
   definition;

}; // скобка на уровне объявления

Enums:

enum ProceedObject
{ // скобка на уровне объявления
   EPO_BAT,
   EPO_LEFT_BORDER,
   EPO_RIGHT_BORDER,
   EPO_UP_BORDER,
   EPO_DOWN_BORDER,
   EPO_FLOOR,
   EPO_CEILING,
   EPO_BRICKS, // значения по отступу,
}; // скобка на уровне объявления

Ifs:

if(condition1) 
{
   DoSomething();
   //...
}
else if(condition2)
{
   DoSomethingOther();
   //...
}
else
{
   DoSomethingOtherAgain();
   //...
}

Sweets

switch(condition) 
{
    case 1:
    case 2:
        x = ...;
    break;
    case 3:
{
         x = ...;
//...
}
    break;
    default:
        x = ...;
    break;
}
 

The specific points of interest are "it works like this now, and it should work like this".


Alignment of brackets has already been voiced.