Le 2017-04-24 08:28, Niclas Hedhman a écrit :
Cool. I guess the IDE was guiding a lot to get that right...
Yep, a lot.
Everything is strongly typed and you get nice contextual autocomplete
and all that.
One annoying thing with the bootstrap API is the difference between
KClass<?> and Class<?>.
Need to add a lot of extension methods.
I did not manage yet to provide Kotlin properties for our properties &
associations.
This would get us to e.g.:
forMixin(Some::class).declareDefaults {
foo = "bar"
}
And the same in application code.
But I'm not even sure it's possible with current Kotlin features.
We'll see.
On Mon, Apr 24, 2017 at 2:12 PM, Paul Merlin <[email protected]>
wrote:
Gang,
I played a little bit with Polygene and Kotlin:
val application = Energy4Java().newApplication(
ApplicationAssembler { factory ->
factory.newApplicationAssembly("Application 1") {
mode = Application.Mode.development
version = "1"
setMetaInfo(Object())
val layer1 = layer("Layer 1") {
module("Module 1/A") {
values(Some::class) {
withTypes(Some::class)
forMixin(Some::class).declareDefaults {
foo().set("bar")
}
}
}
}
val layer2 = layer("Layer 2") {
module("Module 2/A") {
services(Some::class) {
instantiateOnStartup()
}
}
}
layer2.uses(layer1)
}
})
application.activate()
application.passivate()
To get to the code above I added a few Kotlin extensions methods to
the
bootstrap api:
https://kotlinlang.org/docs/reference/extensions.html
I'll push some library/lang-kotlin later, but it looks promising
already.