Skip to content

Gradle plugin parsing Kotlin expressions to JavaScript including type-safe Signals #4

Description

@fmcarvalho

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:

  1. Remove Lambda and value prop - "{ resp.value.lowerCase() == answ.value }" => "$response.lowerCase() == $answer".
  2. Translate kt to Js - "$response.lowerCase() == $answer". => "$response.toLowerCase() == $answer"

!!!!! MAYBE it could be made in reverse order.

  1. Translate kt to Js - ??? it requires an equivalent Signal in JS ??
  2. Remove Lambda and value prop

Start with a simple prototype without native Kotlin to Js compiler, for custom use cases.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    brainstormCaptures speculative concepts that may inspire future work.featureFeature to be implemented

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions