Matyáš Vítek
12/30/2023, 1:45 PMfun <T : GObject> T.onNotify(handler: T.() -> Unit): ULong
like this as an extension function or would there be a way to make it better? The function is used for registering an event and it uses the instance which it is called on as a receiver. Whole implementation:Youssef Shoaib [MOD]
12/30/2023, 2:19 PMGObject
, then I would suggest keeping it in a new lambdaMatyáš Vítek
12/30/2023, 2:37 PMonNotify
function with it on a different instance of GObject
? If so, it's expected to happen just in some rare cases
> I'm not sure how `GObject`s would work
Right now, GObject
is a wrapper for a base class in the GObject library
> If there isn't a reason to avoid holding a regular reference to the GObject
, then I would suggest keeping it in a new lambda
Didn't really get what you mean by this 😅Matyáš Vítek
12/30/2023, 7:34 PMYoussef Shoaib [MOD]
12/30/2023, 8:40 PMfun <T> T.onNotify(handler: T.() -> Unit): ULong = Unit.onNotify { handler(this@onNotify) }
And cleaned up all the `Unit`sDaniel Pitts
12/31/2023, 2:26 AMGObject.onNotify
?