karn
01/12/2022, 7:57 PMAdvitiay Anand
03/14/2022, 9:07 PMAlex Cruise
08/19/2022, 11:02 PMAlex Cruise
08/22/2022, 3:58 PMAlex Cruise
08/22/2022, 4:12 PMShawn
08/22/2022, 4:45 PMAlex Cruise
08/22/2022, 4:49 PMAlex Cruise
08/22/2022, 4:50 PMx not-followed-by y
🙂Alex Cruise
08/22/2022, 4:51 PMThe not-predicate expression !e succeeds if e fails and fails if e succeeds, again consuming no input in either case.
Alex Cruise
08/22/2022, 4:51 PMAlex Cruise
08/23/2022, 12:42 AMCurtis Ullerich
10/06/2022, 8:39 PMval matcher = plus { num { where { it.value > 2 } } variable {} }
val ast = Addition(Number(3), Variable("y"))
val matched = matcher.matches(ast)
I'm hoping to also support property extraction. I implemented something that works, but it feels gross using nullable vars like this:
var value: Int? = null
var name: String? = null
val extracter = plus { num { extract { value = it.value } } variable { extract { name = it.name } } }
val ast = Addition(Number(3), Variable("y"))
extracter.extractFrom(ast)
println("$value $name") // 3 y
Is there a pattern I could use to implement something more like this?
val (value: Int, name: String) = extracter.extractFrom(ast) ?: return null
Viktor Sirotin
01/28/2023, 4:18 PMViktor Sirotin
01/31/2023, 1:00 PMDirk Hoffmann
03/14/2023, 3:15 PM<mailto:this@dsl.xxx|this@dsl.xxx>
) and I don't understand WHY.
I constructed a single executable File to showcase my "problem" (at the end of the file/code)Bradleycorn
05/10/2023, 2:31 PMval appConfig = AppConfig {
name = "My App"
storage {
filePath = "/path/to/some/dir"
}
network {
baseUrl = "<https://api.mysite.com>"
authType = "Basic"
}
}
Wondering if someone might provide some advice on the best way to do this? I have written some code that works, but as this is my first attempt, I’m wondering if I’ve done it the “right”/“best” way. Code is in the 🧵Dirk Hoffmann
05/16/2023, 7:28 AMctxObjs access does NOT work in constructor:
class CtxClass(val value: Int)
data class CtxStore(val ctxObjs: MutableMap<String, CtxClass> = mutableMapOf())
context(CtxStore)
class SomeClass(var ctxO: CtxClass = ctxObjs["someRef"]!!) { // <-- Unresolved reference: ctxObjs
fun someFun() = "SomeClass(${ctxO.value})"
}
ctxObjs access does work in init block:
class CtxClass(val value: Int)
data class CtxStore(val ctxObjs: MutableMap<String, CtxClass> = mutableMapOf())
context(CtxStore)
class SomeClass(var ctxO: CtxClass = CtxClass(0)) {
init {
ctxO = ctxObjs["someRef"]!!
}
fun someFun() = "SomeClass(${ctxO.value})"
}
smallufo
07/09/2023, 9:18 AMMax
07/09/2023, 7:37 PMMax
08/04/2023, 7:16 AM윤동환
08/10/2023, 2:07 AMT.() -> R
and (T) -> R
for function type?
First one called lambda with receiver and second one is the first class function.neerav
08/31/2023, 8:48 AMandroid { signingConfig, defaultConfig etc }
dependencies {}
From above Case I am able to move dependencies { }
into separate dependencies.gradle.kts
file.
Now i am facing issue when I am trying to move signingConfig & defaultConfig etc into separate flavorSigning.gradle.kts
file
Can anyone please help me how can we move defaultConfig and productFlavor code into dedicated gradle.kts file ?
I am not sure where this question should be asked so please guide me if its in wrong channel.
Thank youwakingrufus
10/18/2023, 7:14 PMyolocat
01/19/2024, 4:57 PMMarco Pierucci
02/23/2024, 12:47 PMlibs
notation within convention plugins?
I've seen some using val libs = the<LibrariesForLibs>()
But as per https://github.com/gradle/gradle/issues/19813 thats not intendedrdhruva
06/02/2024, 3:32 PMdependsOn {
"foo"
"bar"
"baz"
}
and then I can "collect" the 3 as a list.
What I ended up doing for now is:
dependsOn {
add("foo")
add("bar")
add("baz")
}
And the definition looks like:
fun dependsOn(init: MutableList<String>.() -> Unit)
Is there a better way to do this, such that I don't need the add(...)
?wakingrufus
07/22/2024, 11:07 PMrad
09/12/2024, 12:22 PMif
as they're already used by the language, so you'd need
`if` (variableA eq variableB)
which feels slightly annoying to use. Is there any alternatives (compiler plugin?) or would it just not be possible?
Example of what I'm talking about:
buildGlslShader { // this: GlslShaderContext
glPosition = projMat * modelViewMat * vec4(position, 1.0)
val iColor = ivec3(color.xyz * 255 + vec3(0.5))
`if` (iColor eq ivec3(78, 92, 36) {
// Change some stuff...
}
}
alexhelder
04/24/2025, 11:15 PMsaver {
val key1 = …
val key2 = …
save = { reference key1/2 },
restore = { reference key1/2 }
}
specifically i would like to declare variables at the top level of the block but reference them in child lambdasneworldlt
07/16/2025, 9:26 PMBSCard {
Body {
div {
div(classes { CARD_TEXT() }) {
+"Some text"
}
}
}
}
Contexts are declared like:
@ComponentDsl
public interface IComponent
fun IComponent.BSCard(
content: @Composable ((@BSContextScope CardContext).() -> Unit) = { }
)
//Here I want to access only to `Body`, which is protected by @BSContextScope
class CardContext(private val context: IComponent) {
fun Body(content: CardBodyContext.() -> Unit)
}
// CardBodyContext inherits @ComponentDsl. Is there any way to override it?
class CardBodyContext(val context: IComponent) : IComponent by context {
fun BSClassListGeneric.CARD_TEXT() = add(BSClass("card-text"))
}
Nothing I tried works. Is there any clever way to overcome this?