Open Aaron3154518 opened 3 years ago
Per meeting with Dr. O today, declaring a variable inside a nested scope should be disallowed. Upon encountering it spf-ie should error and exit.
How does this work for nested computations, which will very often have a decl inside a scope
Per today's meeting, spf-ie will fail upon encountering a declaraction with a name that matches an existing data space. This applies whether the declaration shadows an existing one, or if they are in different non-nested scopes. Because of this solution, declarations inside scopes besides the top-level are ok. Due to renaming this issue will never come up for nested computations.
Implemented in b8e0810e6a4248144ef891d87cd1b823d3ba0aeb
Not sure if this is an issue or not:
Different scopes can have two distinct variables (data spaces) with the same name. However all data spaces in the Computation class are given the same scope. This creates two distinct data spaces which are treated as one due to having the same name. We need to produce two differently named data spaces. We can implement this using a static integer counter. Every time we hit a redeclared variable in a new scope, rename it and every use of it within that current scope to
var__v{counter}
.Example:
Would become: