# Generic function literals with receiver

**URL:** <https://discuss.kotlinlang.org/t/generic-function-literals-with-receiver/12700>\
**Category:** Language Design\
**Created:** [May 12, 2019, 8:49am UTC](https://discuss.kotlinlang.org/t/generic-function-literals-with-receiver/12700 "2019-05-12T08:49:34Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![damiandragowski](https://avatars.discourse-cdn.com/v4/letter/d/a587f6/32.png) [@damiandragowski](https://discuss.kotlinlang.org/u/damiandragowski)\
**Post date:** [May 12, 2019, 8:49am UTC](https://discuss.kotlinlang.org/t/generic-function-literals-with-receiver/12700/1 "2019-05-12T08:49:34Z")

</div>

Hi,  
I’m wondering why it is impossible to define generic function literal which will hold operations generally using only interface method.  
In example above I expect that this definition should add extension function “myAdd” to MuttableCollection of generic type T.

`val <T> myAdd: MutableCollection<T>.(T) -> Boolean = { it -> add(it) }`

is this feasible in Kotlin ?

The counterpart of above is

`fun <T> MutableCollection<T>.myAdd(t :T): Boolean = this.add(t)`

Regards,  
D
