OOP, templates and macros in mql5, subtleties and uses - page 4

 
Alexey Navoykov:
I've already made it - and don't regret it one bit ) But you, I see, take a great pleasure in constraining yourself with artificial restrictions imposed by MQ. Maybe you are a masochist? ) You're so insistent on convincing me that it's necessary. It's not necessary, it's forced - that's the point.

You look more like a masochist. Instead of following the rules of the language you spent your time writing a crutch that nobody needs, trying to pass off your opinion as an axiom, despite the fact that I'm not the only one who tells you about your mistakes. And on top of that, you are trying to pass off your craft as subtleties and tricks. And the subtleties and features turns out to be the observance of the rules described in the documentation.

Take it up with the developers of C language varieties. Listen to the address of the link where you will be sent. And here you think it's acceptable to demand something from the developers in return for your own ignorance.

 
Alexey Viktorov:

You look more like a masochist. Instead of following the rules of the language, you spent your time writing a crutch that no one wants.

Half a day spent on writing a crutch will pay off in my future with a lot of saved time and nerve cells, plus the convenience of the code (I write it the way I need it).

trying to pass your opinion off as axiomatic, despite the fact that I'm not the only one telling you about your mistakes.

...

Take it to the developers of C-languages.

Errors? Have you ever programmed in a real programming language? I don't think so. If you're not aware of it, MQL is written similar to C++. So in this case the developers slipped up and didn't take into account some details and created a bug that cannot be found in normal programming languages.

And here you consider it acceptable to demand something from developers instead of your own ignorance.

You are confused again. I'm not asking for anything anymore.
 
Alexey Navoykov:

Spending half a day writing a crutch will pay off in my future with a lot of time and nerve cells saved, plus the convenience of the code (I write it the way I want it).

Errors? Have you ever programmed in a real programming language? I don't think so. If you're not aware of it, MQL is written similar to C++. So in this case the developers slipped up and didn't take into account some details and created a bug that cannot be found in normal programming languages.

You are confused again. I'm not demanding anything.

Why should mql developers imitate anyone?

 
Alexey Viktorov:

Why on earth would mql developers want to emulate anyone?

Look at the documentation, it says it all in black and white.
 
Alexey Viktorov:

Take it up with the developers of the C language variants. Listen to the address of the link you will be sent to. And here you think it is acceptable to demand something from the developers in return for your own ignorance.

What does the C language family have to do with it? It's only in µl. That's because mk decided to make multi-pass compilation to please those who want to.

void start() {
    int i = f();
}
int f() {return 0;}

Which you shouldn't have done.

ZS:

Generally I've heard here more than once that c++ is a shot in the foot, 70% is not used there at all, we'll make a convenient and safe µl. But it looks more like we need to reinvent this "crooked" c++ for comfortable coding :)

 
Alexey Navoykov:

So you advocate the massive use of global variables, as I understand it. Then you and I are unlikely to understand each other.

Moreover, the function itself may be a template. And the created instance, respectively, should be parameterized by the same type:

Your action?

Not that I'm a supporter, but I don't see anything tense in declaring an instance of a class once and for all, even if it's not necessary for anything but ease of use of static variables. And when lately I myself faced with this bug with statics inside functions, I just decided never to declare them like that (inside functions) and there's no problems at all.

 
pavlick_:

That's because mc decided to do a multi-pass compilation for the benefit of those who want to do

which they shouldn't have done.

I'm afraid he won't understand what you mean )
 
pavlick_:

What's the C language family got to do with it? That's the only thing that's wrong with mcl. That's because µ decided to make multipass compilation for those who want it that way.

Which you shouldn't have done.

ZS:

Generally I've heard here more than once that c++ is a shot in the foot, 70% is not used there at all, we'll make a convenient and safe µl. But it looks more like we need to reinvent this "crooked" c++ for comfortable coding :)

So you're saying you can't initialize a variable with a function? Do I understand it correctly?

 
Ilya Malev:

Not that I'm a supporter, but I don't see anything tense in declaring an instance of a class immediately after its description, even if it's not needed for anything except convenient use of static variables. And when recently I myself faced with this bug with statics inside functions, I just decided never to declare them like that (inside functions) and there's no problems at all.

Well, that's what I started talking about here. I was planning to replace all statics with globals too (although it's hard, of course). But as shown above, it won't work with templates. With macros too. And I use it all widely, so I made my implementation. Although it does not solve all the problems. Dynamic arrays still can not be initialized, constant types too, so they unambiguously have to be globalized.
 
Alexey Viktorov:

So you're saying you can't initialise a variable with a function? Do I understand it correctly?

No, that's not what I'm saying. In pluses static a function member will be initialized the first time it enters the function. About multi-passing - I was in a hurry, I naively thought that µl would allow it

int q = w;
int w;