Typing question - page 8

 
Ilya Malev:

Isn't it the same asPrint(ColorToString(Color&(uint(-1)&65535)|(230<<16)); ?

By the result yes, by the action no.

I'm afraid that I will rack my brains studying your codes.

That is, I mean that everything in your methods is delightful (no kidding) except abundance of capital letters with underscores and context resolution operations:)

I think, that if it (operation of a context resolution) will be allowed to overload, you and your libraries will go to astral :lol:

It's hard not to write a library, but to come up with a usable one.

 
fxsaber:

By result yes, by action no. // well, yes, by actionPrint(ColorToString(Color=(Color&(uint(-1)&65535)|(230<<16)))); :)

It's hard not to write a library, but to come up with a usable one. // Both are difficult if you don't have as much experience in terminal peculiarities as you have :)

 
Ilya Malev:

No, that's not the algorithm used at all. The library doesn't care about the type of variable.

 
fxsaber:

No, that's not the algorithm used at all. The library doesn't care about the type of variable.

It's not the type of variable, but its name=, i.e. assignment. The action and the result are the same - the variable is changed.

I didn't get far into the library though, so please forgive me if something is wrong.
 
Ilya Malev:

It's not the type of variable, but its name=, i.e. assignment. The action and the result are the same - the variable is changed.

Although I didn't go far into the library, so please forgive me if something is wrong.

You can substitute, for example, MqlTick-variable for an integer variable.

 
fxsaber:

You can substitute, for example, an MqlTick-variable for an integer variable.

I understand that everything is universal. We've solved the copying of structures issue in the next thread together :) I am not facing this problem at the moment. And I deal with construction of data of various types from bytes and modification of bit fields too, though the number of optional, without special practical profit :)

 
Ilya Malev:

I understand that everything is universal with you. We solved the issue of copying structures together in a neighbouring thread recently :) I am not facing this problem at the moment. And I have been dealing much with construction of data of various types from bytes and modification of bit fields, although the number of optional, without any particular practical use :)

So, it is possible to create A(Object)[Index] = 5.

 
fxsaber:

I just wanted to say that it is possible to create A(Object)[Index] = 5.

Of course, if you work with everything as one type - sets of bytes or bits or ints, etc., then you can, but this is from another plane, it is not about making simple, intuitive, easy to understand and changeable code.

 

I also like it when there is no difference between int, double and datetime. Here, maybe someone will like the idea (in terms of assignment speed not actually different from the original types):

#property strict

class price{ public:
  int    operator| (double p){return(int)(p*100000);}
  double operator| (int p){return(double)p/100000.0;}};

class time{ public:
  int operator| (datetime p){return(int)uint(p);}
  datetime operator| (int p){return(datetime)uint(p);}};

price f;
time t;

void OnStart()
 {
  int  bid = f|Bid, ask = f|Ask, time1 = t|TimeCurrent(), time2 = t|TimeLocal();
  
  Print("Bid = ", f|bid, " Ask = ", f|ask, " Current time = ", t|time1, " Local time = ", t|time2);
 }  


Will work guaranteed for forex (prices no greater than 21474 integer) and dates up to 2107.
 
Ilya Malev:

I also like it when there is no difference between int, double and datetime.

That is, if you happen to confuse flies with cutlets, to make it as difficult as possible to detect the problem?