You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The implementation hinges on Bash's `declare -n`. When using `get-object`, this is what would happen behind the scenes at the lowest level
74
70
75
71
```sh
76
-
local current_object_name='unique_global_variable_xray'
72
+
local current_object_name='__bash_object_unique_global_variable_xray'
77
73
local -n current_object="$current_object_name"
78
74
79
75
declare -gA REPLY=()
@@ -83,7 +79,7 @@ for key in "${!current_object[@]}"; do
83
79
done
84
80
```
85
81
86
-
Another implementation detail is how a new variable is created in the global scope. This can occur when you are setting an array (indexed array) or object (associative array) at some place in the object hierarchy. In the previous example, `unique_global_variable_xray` is the new variable created in the global scope; in practice, the name looks a lot different, as seen in the example below
82
+
Another implementation detail is how a new variable is created in the global scope. This can occur when you are setting an array (indexed array) or object (associative array) at some place in the object hierarchy. In the previous example, `__bash_object_unique_global_variable_xray` is the new variable created in the global scope; in practice, the name looks a lot different, as seen in the example below
87
83
88
84
```sh
89
85
local global_object_name=
@@ -97,4 +93,4 @@ local -n global_object="$global_object_name"
97
93
global_object=()
98
94
```
99
95
100
-
The `%q` probably isn't needed (it was originally there because the implementation previously used `eval`), but it's still there as of this writting
96
+
The `%q` probably isn't needed (it was originally there because the implementation previously used `eval`), but it's still there as of this writing
0 commit comments