basex icon indicating copy to clipboard operation
basex copied to clipboard

Organize global variables by declaring module

Open GuntherRademacher opened this issue 1 month ago • 0 comments

Private variables declared in a library module are no longer required to be in the module namespace (see 5.16 Variable Declaration). The corresponding check can be adapted easily, but the management of global variables in the Variables class currently mixes variables from all modules without taking into account where they were declared. As a result, it is not possible to use the same private variable name in multiple modules.

This PR

  • groups variables by declaring module to avoid name clashes
  • checks the declaring module to prevent main-module variables from becoming visible in imported modules
  • allows private variables of a module to be visible in all files comprising that module (as public variables already are)

Tests for this have been added in ModuleTest.variableVisibility.

There is also an unrelated fix for a typo in a built-in record field name in enum Records.

The changed naming rules apply to functions as well, but I’d prefer to address that in a separate task.

GuntherRademacher avatar Nov 19 '25 14:11 GuntherRademacher