Maybe anyone already propose that, but it would be...
# language-proposals
d
Maybe anyone already propose that, but it would be nice for writing DSLs, if I could create extensions in a context of other extensions. For example, I have my react bindings and I create some factory for my element, like:
Copy code
fun ReactProps.myElement(setter: MyElementProps.() -> Unit): ReactElement =
  React.createElement(MyElement::class, setter(MyElementProps))
But I want to, in a context of another ReactProps, an element to be extended by the unary operator, so with that I could write something like this:
Copy code
rootElement {
  +myElement {
    // ...
  }
}
That is needed when you don’t have access to the original source of the thing that you want to understand. So we need something like this (maybe another one more beautiful syntax):
Copy code
operator fun ReactProps.unaryOperator(element: ReactElement?) {
  ...
}