dephinera
05/21/2023, 1:18 PMYoussef Shoaib [MOD]
05/21/2023, 2:02 PMdephinera
05/21/2023, 2:51 PMYoussef Shoaib [MOD]
05/21/2023, 2:53 PMYoussef Shoaib [MOD]
05/21/2023, 2:54 PMdephinera
05/21/2023, 3:15 PMYoussef Shoaib [MOD]
05/21/2023, 3:23 PM//User code
@ConfiguresLibraryDsl
fun config(): Config<MyType, MyOtherType, Extras.Combine3<Extras.EnableFeature1, Extras.EnableFeature2For<ADifferentType>, Extras.CustomizeFeature3<SomeToggle>>> = TODO()
You can have some of the info in parameters, receivers, etc. Sealed classes/interfaces are really your friend here. The nice thing about this is that you can have it so that the config function is declared inside a class to associate it with a specific class.
Also, I can't remember if KSP would let you see the inferred return types of expression functions or not, but if it can, then you can have it be more DSL-y by having functions that produce a Config from the types you enable, and you'll hence get the ability to make a lot of convenience functions, which will make the user experience much better.Youssef Shoaib [MOD]
05/21/2023, 3:30 PMdephinera
05/21/2023, 3:55 PMYoussef Shoaib [MOD]
05/21/2023, 4:02 PM