Originally created by @EvgSkv on GitHub (Feb 14, 2024).
What if I need to access a field p which is two levels up? Seems like outer.outer.p should access it, but I am getting an error.
p = "value one"
d1 {
p = "value two"
w = outer.p // OK
d2 {
x = p // OK
y = module.p // OK
z = outer.outer.p // Results in an error, but shouldn't this resolve to p which is "value one"?
}
}
Originally created by @EvgSkv on GitHub (Feb 14, 2024).
What if I need to access a field `p` which is two levels up? Seems like `outer.outer.p` should access it, but I am getting an error.
```
p = "value one"
d1 {
p = "value two"
w = outer.p // OK
d2 {
x = p // OK
y = module.p // OK
z = outer.outer.p // Results in an error, but shouldn't this resolve to p which is "value one"?
}
}
```
Or, if it happens to be defined on the module level, access through module:
prop=1obj{obj{obj{prop=module.prop}}}
@bioball commented on GitHub (Feb 15, 2024):
Right; `outer` can't be nested.
To go further out, you can add a `local`:
```groovy
obj {
local self = this
obj {
obj {
prop = self.prop
}
}
}
```
Or, if it happens to be defined on the module level, access through `module`:
```groovy
prop = 1
obj {
obj {
obj {
prop = module.prop
}
}
}
```
Is there a reason why outer can't be nested? Addressing a field two levels above seems natural. Are there plans to enable nesting?
Seems like nesting would be a good feature :-)
Thank you for your work and fast response!
@EvgSkv commented on GitHub (Feb 15, 2024):
Is there a reason why outer can't be nested? Addressing a field two levels above seems natural. Are there plans to enable nesting?
Seems like nesting would be a good feature :-)
Thank you for your work and fast response!
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Originally created by @EvgSkv on GitHub (Feb 14, 2024).
What if I need to access a field
pwhich is two levels up? Seems likeouter.outer.pshould access it, but I am getting an error.@bioball commented on GitHub (Feb 15, 2024):
Right;
outercan't be nested.To go further out, you can add a
local:Or, if it happens to be defined on the module level, access through
module:@EvgSkv commented on GitHub (Feb 15, 2024):
Is there a reason why outer can't be nested? Addressing a field two levels above seems natural. Are there plans to enable nesting?
Seems like nesting would be a good feature :-)
Thank you for your work and fast response!