Did Structs Change with the last MT5 Update? - page 4

 
Doerk Hilger #:
Its the nature of a struct that you have sequential data, managed via the stack at once. Thats exactly the advantage vs. classes. And doing it with this= is the fastest and most natural way. The data is copied via rep stos(x) (assembler) at once. Single assignments, var by var, takes the same time for each var. If you have a struct with 50 fields, you need 50 times the time. 

So you end up with a stackoverflow, still you are thinking it's fine to do it ?

As you like. 

 
Alain Verleyen #:

So you end up with a stackoverflow, still you are thinking it's fine to do it ?

As you like. 

You only end up with it when you use both: this= in the assignment function and overloading the operator.
And yes. This might not be a big deal with 2-4 fields, but with structs that have 50+ fields, the chance for human mistakes and other bugs is way higher then.  
Besides this, you can also send a struct to a DLL function and do the copy job there, without any conversion to CharArray, if you like that better. 

 
Alain Verleyen #:

This change is in preparation to the transition to the new compiler which will probably include a lot of things you will like to see. And most probably some missing features which we would like (for example there will not be multiple inheritance even in a simplified way), we will see.

What do you mean and what do you know?

Multiple inheritance ... isn´t that anyway hell of confusing and hard to read later? 

 
Doerk Hilger #:

What do you mean and what do you know?

A new compiler is on the roadmap, and I only know what I have read on the Russian forum.

Multiple inheritance ... isn´t that anyway hell of confusing and hard to read later? 

It depends how it's implemented. A multiple interfaces inheritance would be really useful and not confusing. Anyway, no point to discuss it as it will not be available in MQL.
 
Alain Verleyen #:
A new compiler is on the roadmap, and I only know what I have read on the Russian forum.
This sounds concerning for me. Im happy its all kinda working with all the workarounds created over the years. 
 
Alain Verleyen #:
A multiple interfaces inheritance would be really useful and not confusing
Like in C#, sure. But when I think about "friend"  ...
 
Doerk Hilger #:
Like in C#, sure. But when I think about "friend"  ...
That something else, we don't want friends 😂
 
Alain Verleyen #:
A multiple interfaces inheritance would be really useful and not confusing. Anyway, no point to discuss it as it will not be available in MQL.

Новая версия платформы MetaTrader 5 build 5200: расширение OpenBLAS и усиление контроля в MQL5

Ilyas, 2025.08.12 10:11

Sergey Gridnev #
PS. It would be better if you implemented interfaces.

(editor’s note: here he means instead of hiding parent classes’ public methods)


Interfaces do exist.

I suspect you mean multiple inheritance?
That has been postponed for now.

And by the way, multiple inheritance has its own nuances when resolving conflicts: if two or more parent classes have functions with identical signatures, which one should be called?
By inheritance order?
Change the order of inheritance = the behavior changes...

(automatic translation applied)
 
Vladislav Boyko #:
I suspect you mean multiple inheritance?
That has been postponed for now.

Considering that the recently released change was planned 5 years ago, I think we can expect multiple interface inheritance in 8-10 years.

Новая версия платформы MetaTrader 5 build 5200: расширение OpenBLAS и усиление контроля в MQL5

Ilyas, 2025.08.11 14:26

The scope in the new version of MQL has its own list of named compilation objects (variables, functions, etc.).

When searching for a named entity, the compiler walks the scope tree from the current scope up to the global root, stopping at the first match. This results in hiding all entities with the same name that exist in higher scopes.

We warned about this upcoming change on the forum five years ago. In compiler versions prior to 5200 you could see a compilation warning:

deprecated behavior, hidden method calling will be disabled in a future MQL compiler version

(Automatic translation applied. Part of the post has been omitted, as it requires understanding the context from other posts in that discussion.)

 
Vladislav Boyko #:

Considering that the recently released change was planned 5 years ago, I think we can expect multiple interface inheritance in 8-10 years.


(Automatic translation applied. Part of the post has been omitted, as it requires understanding the context from other posts in that discussion.)

Multi-inheritance was approved then stopped years ago already (it's somewhere on the forum). I don't think it will ever be implemented. It's a pity as it prevents to code very interesting patterns like 'Policy based design'.