I understand why for `getValue` and `setValue` the...
# language-evolution
p
I understand why for
getValue
and
setValue
the semantics of context-parameters would be murky (is the context resolved on use or on declaration), but what is the reason not to support context-parameters on
provideDelegate
? Would the semantics not be quite clear that the context-parameter is used at declaration, i.e at the
val x by y
and non-contextual
getValue
/`setValue` used as any other delegate?
3
b
In pet projects of mine I actually suppress the error that stops you from adding a context to provideDelegate, and it works as expected at the use site. Wouldn't recommend it obviously, but this restriction does make it impossible to expose provideDelegate in DSLs that use a context. I'm hoping for official support because I have a library that would factor out really nicely if I were able to migrate its delegate away from extension-based DSL scopes. (In this example I'd like it to be a well-named non-extension "declareParameter" function, then have it called by a contextual provideDelegate in the DSL. I want manually delegating this function to be easy, but as it is now, delegating to a "base" scope's provideDelegate is pretty awkward.
There was some brief discussion here, but I don't think there's been a solid answer yet about where this stands