Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 389

 
can there be 2 ontic functions in one programme?
 
Максим Дмитриев:
can there be 2 ontic functions in one programme?
No!
 
Максим Дмитриев:
can there be two ontic functions in one program?
One.
But who prevents it from running the custom OnTickOne(), OnTickTwo(), OnTickThree(), etc.?
 
Максим Дмитриев:    can there be two ontic functions in one program?

It's easy to check it yourself.

It's the second one.

// Так работает, но вызывается только OnTick()
void OnTick()
{
  Alert("Вызов функции OnTick()");
}

void start()
{
  Alert("Вызов функции start()");
}
If you leave a single start function, it works too. After all, start is an obsolete name. The more fashionable name is OnTick. Fashion is statistically a more frequent occurrence.
 
STARIJ:

It's easy to check for yourself

Swearing at the second one

If you leave the start function alone, it works too. After all, start is an obsolete name. A more fashionable name is OnTick. Fashion - in statistics, it means more frequent.

It's not about fashion. The point is that at some point support for obsolete functions will cease. And the "mods" will not suffer. But those who still use obsolete features - they will correct everything that has been built up over the years.

 
Artyom Trishkin:

It's not about fashion. The point is that, at some point, support for outdated features will cease. And the "mods" will not suffer. But those who are still using outdated features - they will be correcting all the years' worth of work.

What am I wondering is why CodeBase still accepts code using those very obsolete event handling functions if they may be disabled one day?

 
Alexey Viktorov:

I do wonder why CodeBase continues to accept code that uses these outdated event handling functions, if they can be turned off at some point?

Who knows...? Question for SD.

 
Alexey Viktorov:

What amazes me is why CodeBase continues to accept code using those very obsolete event handling functions if they may be disabled one day?

It's very simple. Judging by the example, which contains both start and OnTick, they are perceived differently by the compiler and displayed differently in ex4 code. The Ex4 executor also distinguishes them - the OnTick () event handler is the OnTick() function and in its absence, the start() function. Doing away with the start() function would require redesigning both the compiler (which is present in both MetaEditor and Terminal) and the executor in Terminal.

The result will be a tiny reduction of MetaEditor and Terminator code + new bugs. And a mountain of screaming. Do they need it?

 
STARIJ:

It's very simple. Judging by the example, which contains both start and OnTick, they are perceived differently by the compiler and displayed differently in ex4 code. The Ex4 executor also distinguishes them - the handler of the OnTick event is the OnTick() function and in its absence it is the start() function. Giving up the start() function would require redesigning both the compiler (which is present in both MetaEditor and Terminal) and the executor in the Terminal.

The result will be a tiny code reductions in MetaEditor and Terminal + new bugs. And a mountain of crying. Do they need it?

I don't mean how they work, but why accept such codes in CodeBase if they may stop working soon.

 
Alexey Viktorov:

I'm not talking about how they work, but why accept such codes in CodeBase if they may soon stop working.

I thought I explained that they will work forever
Reason: