not sure if this is even the right channel, but ho...
# language-proposals
t
not sure if this is even the right channel, but how soon can we expect local function declarations in inline functions?
g
Maybe make sense to report an issue or find existing one. I suppose that question "how soon" is not really make sense for this channel without an issue Just curious what is your case?
t
use case is functional programming with many higher order functions. It's sometimes useful to extract a portion of the expression to a local function for clarity and the outer function should be inlined for performance reasons. The linter told me that "local functions are not yet supported in inline functions" so I assumed it was a known problem that they area at least working on.
k
I guess the underlying issue is that local functions are inherently private and inline functions inherently can't access private things.
Maybe they haven't found a solution yet?
r
@tschuchort does
crossinline
work for you there?
t
you mean as a modifier for a local function?
nope doesn't work
k
@raulraja It's about this:
Copy code
inline fun foo() {
    fun bar() {}
    bar()
}
, there's nothing to
crossinline
.
g
Why not just use lambda instead of local function?
Copy code
inline fun foo() {
    val bar = {}
    bar()
}
Be free to report an issue
Maybe way how I work with code is different, but it’s pretty rare case when I use even local lambda and never local function