declex icon indicating copy to clipboard operation
declex copied to clipboard

If forwarders for Actions

Open smaugho opened this issue 7 years ago • 0 comments

Right now Actions are executed inside their blocks. A negative effect of this is that actions inside an IF block cannot forward to the next code, let's say we have the following code:

if (something) {
    $SomeAction();
    doSomethingElseAfterSomeAction();
}

executeSomeMethod();

In the current action mechanism, in the example above, if "something" is true, the code will be executed really like this:

if (something) {
    $SomeAction();
    doSomethingElseAfterSomeAction();
} else {
    executeSomeMethod();
}

Following Java rules of executions, this is not the correct behavior.

To be able to accomplish this, all the code after an IF block should be encapsulated in a Runnable interface, which could be called later.. so, when an if is detected, a runnable will be done with all the code finishing the if statement. This runnable will be called at the end of the if statements.

To try to avoid "deforming" the code a lot, this will be done only if inside the Ifs, an action is detected (then it is necessary).


Now, by default when an action selector is used, the action selector is a completely different block. In DecleX 1.+, the Action selectors also have similar behavior than the If statements. I propose also to do similar thing when an action selector is triggered.

Note that right now "else" statements are available in Action Selectors, which make sense.

So the idea in general is to follow a more "normal coding" behavior in the actions with Ifs statements.

smaugho avatar Jun 12 '17 15:06 smaugho