rohd
                                
                                 rohd copied to clipboard
                                
                                    rohd copied to clipboard
                            
                            
                            
                        Add support for `++` and `--` types of operations in conditional logic
Motivation
There are cases in procedural execution in _Always blocks where ++ and -- are useful.  Dart does not allow overloading these operators, however.
Desired solution
Some sort of function on Logic which acts like ++ and --, both postfix and prefix (i.e. ++x vs. x++).  Some thought has to go into the API and function names to make this intuitive.
To effectively use these requires some careful thought.  A prefix is simple, i.e. ++x is the same thing as x + 1.  A postfix requires that the original signal is returned, but then a modified conditional operation is performed afterwards.  This means that it needs to return some special type of object that other Conditionals can handle, but that also might need to play nicely with other Logic manipulation within conditional procedural logic.  There's a number of combinations to consider, and this could involve some modifications to the way things like ConditionalAssignments work in general.
Alternatives considered
Just omit the feature.
Additional details
There are real designs where users had wished for a feature like this.
Adding something like += and -= would also be good!
Hey Max, I would like to give a try on this issue! :)
@RPG-coder-intc great! Let me know once you have a strategy mapped out if you'd like to review the approach. I expect there could be some tricky surprises in implementing this.
A function will be made for postIncrement and preIncrement taking the Logic object value as a reference. The result computation will be worked on this reference object taken as a parameter.
Similar pattern will be followed on += (addAssign(&ref)) , -= (diffAssign(&ref)) , *= (mulAssign(&ref)), /= (divAssign(&ref)).
logicVar++ ===  postIncr(&ref)
++logicVar ===  preIncr(&ref)
Perhaps it's better to use subAssign instead of diffAssign?
Perhaps it's better to use
subAssigninstead ofdiffAssign?
It can be done. What's your say @mkorbel1 ?
Why not make postIncr and preIncr support another input (which defaults to 1) so that the same function can support ++ and +=?  Then the natural extension for subtraction would be postDecr and preDecr.
Why not make
postIncrandpreIncrsupport another input (which defaults to 1) so that the same function can support++and+=? Then the natural extension for subtraction would bepostDecrandpreDecr.
The would be a great addition.
I can make Logic addAssign(&ref=Const(value:1)) get reused the function within postIncr or preIncr
I can make Logic addAssign(&ref=Const(value:1)) get reused the function within postIncr or preIncr
Not sure what the difference would be between those two, but I guess you can code it to show that