Yeah, normalization of Input/output data type is very standard and pros of function as we know. Changing harder is also one of the basics(and pros). As transformng to Action blocks, the code safty and stability are improve
Basically, a "function-ish" macro can be realized by a regular macro as you guys know.
As my code refuctorings, a caller macro just sets arguments as a string in a global variable, then a "function" detect it via "Variable change" trigger and find a specific code block. After processing, write the return value back in the global variable and die. The caller is resumed by "Variable change" trigger in "Wait until" action.
The technique has a cons like followings:
- Not guarantee the dependency. Once adding even 10ms wait, the "function" is suspended(but continues after another macro die)
- Have possibility to occur unexpected macro errors. As the management reason, I set the argument packed in a string and split it in the "function" side. I always check Input values before processing(I never believe me). The input data type definition feature is helpful to reduce unexpected "function" macro side data handling errors.
- Naming and namespace. I named both a caller macro code block and a "function" code block to check the fact where it comes from and it surely runs, but they are not guaranteed unique.
- Splitting is a little annoying. The regex performance is not so good, especially Extract Text action, and stacks in a loop sometimes. And that's the routine I execute most frequently
- Looks different in a macro clearly. "Action block" action has its own unique keyword and the icon. So easy to identity even in a super long macro as same as a plugin call is, while "Set variable" action for just setting a value is very common and too many.
I wish Action blocks solve the cons a normal function-ish macro has. On the other hand, it still has a pros that it can be codable wherever I want(and it's also a cons).
I'm not sure what
@Dm114 want to say and what "very different" is, but I expect above Action blocks pros as only the differences.