Originally created by @HT154 on GitHub (Aug 31, 2025).
cf. Peter's old notes
Currently, outer.foo literally accesses foo on outer. Instead, it should work more like super.foo, i.e., access the lexically closest foo, not necessarily on the directly enclosing object. Perhaps outer.foo should also work for method parameters and local properties, e.g. function myFunction(bar) = new { bar = outer.bar }
This is a potentially breaking change in cases like this:
class A {
foo: String = "baz"
b: B
}
class B {
foo: String
}
foo: String = "bar"
a: A = new {
b {
foo = outer.foo
}
}
In the current state, a.b.foo is "baz" since outer refers to a. As proposed, if outer.foo refers to the "lexically next outer" foo then a.b.foo is "bar".
Originally created by @HT154 on GitHub (Aug 31, 2025).
cf. Peter's old notes
> Currently, `outer.foo` literally accesses `foo` on outer. Instead, it should work more like `super.foo`, i.e., access the lexically closest `foo`, not necessarily on the directly enclosing object. Perhaps `outer.foo` should also work for method parameters and local properties, e.g. `function myFunction(bar) = new { bar = outer.bar }`
This is a potentially breaking change in cases like this:
```pkl
class A {
foo: String = "baz"
b: B
}
class B {
foo: String
}
foo: String = "bar"
a: A = new {
b {
foo = outer.foo
}
}
```
In the current state, `a.b.foo` is `"baz"` since `outer` refers to `a`. As proposed, if `outer.foo` refers to the "lexically next outer" `foo` then `a.b.foo` is `"bar"`.
d = 5
a = (prop) {
b {
// currently, resolves to `6`.
// If changed to "lexically closest `d`", this lookup resolves to `5`.
c = outer.d
}
}
prop {
d = 6
}
I don't think this makes sense to change now. But, one paper cut here is that outer can only look up one level higher. Possibly, we should allow outer to be chained.
@bioball commented on GitHub (Sep 1, 2025):
This would definitely be a breaking change.
```pkl
d = 5
a = (prop) {
b {
// currently, resolves to `6`.
// If changed to "lexically closest `d`", this lookup resolves to `5`.
c = outer.d
}
}
prop {
d = 6
}
```
I don't think this makes sense to change now. But, one paper cut here is that `outer` can _only_ look up one level higher. Possibly, we should allow `outer` to be chained.
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 @HT154 on GitHub (Aug 31, 2025).
cf. Peter's old notes
This is a potentially breaking change in cases like this:
In the current state,
a.b.foois"baz"sinceouterrefers toa. As proposed, ifouter.foorefers to the "lexically next outer"foothena.b.foois"bar".@bioball commented on GitHub (Sep 1, 2025):
This would definitely be a breaking change.
I don't think this makes sense to change now. But, one paper cut here is that
outercan only look up one level higher. Possibly, we should allowouterto be chained.