Regarding the plugin parsing Kotlin expressions to JavaScript there is a 1st goal that is simply translating a Kotlin expression to the equivalent JS expression.
From this 1st problem may arise a 2nd issue when this expression has references to a strongly-typed Signal. In that case the expression may become invalid. E.g. "$response.toLowerCase() == $answer"
If resp is a Kotlin variable of Signal("response") then we cannot chain the call to lowerCase such as resp.lowerCase. We also need the value to make the comparison with the other signal's value, i.e. answ.
In this case we might need a property value in Signal { resp.value.lowerCase()} == answ.value }.
So the plugin should work in 2 steps:
- Remove Lambda and value prop -
"{ resp.value.lowerCase() == answ.value }" => "$response.lowerCase() == $answer".
- Translate kt to Js -
"$response.lowerCase() == $answer". => "$response.toLowerCase() == $answer"
!!!!! MAYBE it could be made in reverse order.
- Translate kt to Js - ??? it requires an equivalent Signal in JS ??
- Remove Lambda and value prop
Start with a simple prototype without native Kotlin to Js compiler, for custom use cases.
Regarding the plugin parsing Kotlin expressions to JavaScript there is a 1st goal that is simply translating a Kotlin expression to the equivalent JS expression.
From this 1st problem may arise a 2nd issue when this expression has references to a strongly-typed Signal. In that case the expression may become invalid. E.g.
"$response.toLowerCase() == $answer"If
respis a Kotlin variable ofSignal("response")then we cannot chain the call tolowerCasesuch asresp.lowerCase. We also need the value to make the comparison with the other signal's value, i.e. answ.In this case we might need a property
valuein Signal{ resp.value.lowerCase()} == answ.value }.So the plugin should work in 2 steps:
"{ resp.value.lowerCase() == answ.value }"=>"$response.lowerCase() == $answer"."$response.lowerCase() == $answer". =>"$response.toLowerCase() == $answer"!!!!! MAYBE it could be made in reverse order.
Start with a simple prototype without native Kotlin to Js compiler, for custom use cases.