-
-
Notifications
You must be signed in to change notification settings - Fork 358
XX PhIP Requestor Variables
Marcus Denker edited this page Jun 30, 2021
·
4 revisions
When assigning a variable that starts with a lower case letter, the compiler will automatically add a binding to the requestor.
sending #lookupVar: to a RequestorScope creates the binding in the requestor (the tool) silently.
- The mechanism is hidden. It happens without feedback from the programmer. A typo thus can lead to a new binding instead of a warning. Beginners might not be aware at all of the concept.
- We can not create Global bindings.
- Code complexity: as asking for a variable will create the binding, we need two methods for variable lookup: one that creates a binding, one that does not. -- hard to understand: asking if a variable exists --> no creation, #lookupVar:, does create. Has led to bugs in the past. -- hard coded logic. E.g. we check for uppercase in the variable lookup of the RequestorScope
- The workspace could just show the undeclared variable with a gutter icon that allows a repair action.
- With Undeclared Variables in Pharo10, we will force user interaction on assign --> This would allow us to open a fixed dialog at execution
The repair action then would be the same that we use for other undeclared variables.
- The fixing code should ask the outer scopes if they can provide a definition --> this would allow to define global and shared vars, too.