1.
Introduction and Objective
This proposal aims to enhance the efficiency and readability of the RouterOS Scripting language (RSC). We propose the addition of support for common Compound Assignment Operators, such as += and -=, which are standard features in almost all modern programming languages.
2.
Current Problem
In the current versions of RouterOS Scripting, modifying a variable's value based on its existing value requires explicitly typing the variable's name twice. This leads to verbose code, reduces readability, and increases the potential for simple typographical errors, especially in complex scripts.
Current Format (Verbose):
:set counter ($counter + 1)
:set totalBytes ($totalBytes + $indexBytes)
This syntax is non-concise and hinders efficient script maintenance.
3.
Proposed Solution (Compound Operators)
We request support for the standard Compound Assignment Operators (+=, -=, *=, /=, %=) to simplify integer-based arithmetic in RouterOS scripting. This feature allows concise modification of a variable's value, replacing the verbose format (e.g., :set x ($x + 1)) with the efficient syntax (e.g., :set x += 1). Implementing this industry-standard feature will significantly improve code readability and accelerate scripting efficiency for all users.
4.
Expected Benefits
- Improved Readability: Makes scripts clearer, cleaner, and easier to understand upon review.
- Code Conciseness: Shortens scripts, which is beneficial for overall code management.
- Faster Scripting: Enables engineers and developers to write scripts more quickly and with fewer chances of basic syntax errors.
- Industry Alignment: Brings the RouterOS scripting language closer to industry best practices found in languages like C, Python, and JavaScript.
5.
Conclusion
The inclusion of Compound Assignment Operators is a minor technical change with a significant positive impact on the User Experience (UX) for developers and administrators who rely heavily on RouterOS scripts. We hope this proposal will be considered for adoption in future system updates.
Sincerely,