2017-10-20 04:57:30 +02:00
|
|
|
# Hyperstatic Global Environment
|
|
|
|
|
2017-10-22 20:39:45 +02:00
|
|
|
This now brings up an interesting subpoint. Retro provides a *hyper-
|
|
|
|
static global environment.* This can be difficult to explain, so let's
|
|
|
|
take a quick look at how it works:
|
2017-10-20 04:57:30 +02:00
|
|
|
|
2017-12-22 00:18:21 +01:00
|
|
|
~~~
|
2020-10-01 01:02:23 +02:00
|
|
|
#1000 'a var-n
|
2017-10-20 04:57:30 +02:00
|
|
|
:scale (x-y) @a * ;
|
2018-05-07 18:39:49 +02:00
|
|
|
#3 scale n:put
|
2017-10-20 04:57:30 +02:00
|
|
|
>>> 3000
|
|
|
|
#100 !a
|
2018-05-07 18:39:49 +02:00
|
|
|
#3 scale n:put
|
2017-10-20 04:57:30 +02:00
|
|
|
>>> 300
|
2020-10-01 01:02:23 +02:00
|
|
|
#5 'a var-n
|
2018-05-07 18:39:49 +02:00
|
|
|
#3 scale n:put
|
2017-10-20 04:57:30 +02:00
|
|
|
>>> 300
|
2018-05-07 18:39:49 +02:00
|
|
|
@a n:put
|
2017-10-20 04:57:30 +02:00
|
|
|
>>> 5
|
2017-12-22 00:18:21 +01:00
|
|
|
~~~
|
2017-10-20 04:57:30 +02:00
|
|
|
|
|
|
|
Output is marked with **\>\>\>**.
|
|
|
|
|
2017-10-22 20:39:45 +02:00
|
|
|
Note that we create two variables with the same name (*a*). The definition
|
|
|
|
for `scale` still refers to the old variable, even though we can no longer
|
|
|
|
directly manipulate it.
|
2017-10-20 04:57:30 +02:00
|
|
|
|
2017-10-22 20:39:45 +02:00
|
|
|
In a hyper-static global environment, functions continue to refer to the
|
|
|
|
variables and earlier functions that existed when they were defined. If
|
|
|
|
you create a new variable or function with the same name as an existing
|
|
|
|
one, it only affects future code.
|