tact icon indicating copy to clipboard operation
tact copied to clipboard

Make sure SendParameters's mode value makes sense

Open anton-trunov opened this issue 1 year ago • 2 comments

For instance,

SendParameters{
    ...
    mode: SendRemainingValue + SendRemainingValue, 
    ...
}

should result in a compilation error.

  • flags in the mode field should be used at most one time;
  • the mode expression should only contain the + sign;
  • TODO: check if some combinations of flags are meaningless;
  • integer literals should not be used, only symbolic constants.

Ideally, arithmetics should be excluded here at all and the mode field should have its own unique type. But it looks like an idea for Tact 2.0, because we break backwards compatibility in this case.

anton-trunov avatar Mar 20 '24 17:03 anton-trunov

Actually it would make sense to move from + to | operation for applying flags because it literally sets specific bit to 1, and in that case applying the same flag multiple times won't change anything

Gusarich avatar Mar 27 '24 04:03 Gusarich

This is indeed a nice suggestion for the current implementation!

anton-trunov avatar Mar 27 '24 19:03 anton-trunov