Loosely related to: PolyScope X: Variable Scoping (Private, Module and Global Variables) - Product Wishlist - Universal Robots Forum
Summary
Add Function Parameters to PolyScope X Functions
What is it?
PolyScope X allows users to create and call functions, but functions cannot declare input parameters. Data must instead be exchanged through globally accessible variables.
Requested enhancement:
Allow functions to define explicit input parameters and permit users to provide argument values directly when calling a function.
The underlying capability already exists in URScript, where functions can accept parameters. This feature request is therefore focused on exposing that functionality through the PolyScope X programming interface.
Why is it needed?
Functions without parameters create implicit dependencies on external state.
Today, a function cannot explicitly define which information it requires from its caller. Instead, data must be exchanged through globally accessible variables. This makes dependencies less visible and increases the risk of unintended interactions between unrelated parts of the program.
Function parameters are a fundamental software engineering concept because they allow a function to clearly define its inputs and establish an explicit contract between the function and its caller.
Adding parameter support would:
- Reduce dependency on global variables
- Improve code readability
- Improve maintainability
- Simplify debugging
- Reduce the risk of unintended side effects
- Encourage modular and reusable program design
As URScript already supports function parameters, the required foundation is already present. Exposing this capability in PolyScope X would provide a significant usability improvement while requiring only limited changes to the user interface.