bodiam
09/01/2021, 12:32 PMlateinit var childFolder1 : FolderNode
lateinit var childFolder2 : FolderNode
val rootFolder = buildFolders(am,"System") {
childFolder1 = folder("A") {
+entry(Attribute("x"), Sample("1"))
}
childFolder2 = folder("A") {
+entry(Attribute("x"), Sample("2"))
+entry(Attribute("x"), Sample("2"))
}
+childFolder1
+childFolder2
}
println(childFolder1) // simplified here
As you can see, I need a reference to childFolder1 in my code, but my current solution seems a bit non-idiomatic, so I was wondering if you have any suggestions on how to improve this?
(I’m also not sure if this is the right channel, the new setup confuses me a bit, so if I need to post this somewhere else, please let me know)Paul Griffith
09/01/2021, 2:36 PMby
keyword), but having tried to implement almost exactly this problem myself, I was never able to come up with a very satisfactory solution. I don't know if there is a way to do this and maintain compile-time safety, but I'd be happy to be wrong 🙂bodiam
09/02/2021, 1:06 AMby
, see if I can get someplace with that.