Allow redefinition of input variable if starts as undefined in module definition
One of the key drivers for SCA2D was to find times that variables were redefined in inner scopes which could create confusing bugs later on. However, when giving a sensible default value that depends on other inputs it does make sense to redefine in this case:
module widget(width, height, separation=undef){
separation = isundef(separation) ? width/2 : separation;
...
}
This should be fine if:
- Variable is explicitly set to undef in header
- The line that redefines the input is the first line in the module
- The redefinition is a ternary using isundef, and leaves the input unmodified if defined
Edited by Julian Stirling