Reproduced in Pkl 0.30.0.
In my code it's a common pattern to compute an intermediate property with a let binding, like this:
function frobnicate(arg: String) =
let (foo = process(arg))
new Frobnication {
foo = foo
}
However this naive version causes a stack overflow. Unfortunately, none of the other scoping keywords help me here:
this references the Frobnication object being created.
outer references the class/module on which .frobnicate() was called.
super references the superclass of Frobnication if any.
module references the containing module.
In particular, for function properties this means I have to either uglify my parameters or define aliases:
// Shows up in Pkldoc, not great :(
function frobnicate(foo_: String) = new Frobnication {
foo = foo_
}
// Extra let binding
function frobnicate(foo: String) =
let (foo_ = foo)
new Frobnication {
foo = foo_
}
I'm not quite sure what a nice way to solve this is. outer feels like the closest candidate that should work for this purpose, but it might mean that logically, an "intermediate" object is created which represents the method's scope (closure?).