-
In this simplified example, is it possible to have |
Beta Was this translation helpful? Give feedback.
Answered by
HT154
May 4, 2025
Replies: 2 comments 1 reply
-
If I'm interpreting your goal correctly, I think you want something like this: class A {
name: String
local _a = this // this "captures" this A so it can be used unambiguously in inner scopes
b: Mapping<String, B> = new {
default {
name = _a.name
}
}
}
class B {
name: String
} So writing this: test = new A {
name = "test"
b {
["abc"] {}
["def"] { name = "def" }
}
} Produces test {
name = "test"
b {
["abc"] {
name = "test"
}
["def"] {
name = "def"
}
}
} |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
jmgilman
-
Ah, it was the |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If I'm interpreting your goal correctly, I think you want something like this:
So writing this:
Produces