Skip to content

Binder: a public companion object is reachable from Python as a value (Owner.Companion) #322

Closed

Description

@b-re-w

Context: Card(modifier=Modifier) still fails in real Compose (pythonx-compose SPEC S6.2 partial). Kotlin's empty Modifier is the companion object Modifier.Companion itself, and the binder never binds a companion instance (only its members: Owner.prop is called as Owner.Companion.prop). So pythonx-compose has nothing to hand to register_empty (#308).
Generic feature, no Compose name in the binder: a Kotlin-public companion object of a public class becomes a value from Python, reached by its Kotlin name (Owner.Companion, or the companion's own name if it has one). The generated Kotlin source names the companion and kotlinc compiles it to GETSTATIC Owner.Companion (no JVM name lookup, rule 12.4).
Completion: SPEC item; walker and runtime tests; Modifier.Companion from Python is a Modifier and works as an argument (e.g. register_empty(Modifier, lambda: Modifier.Companion) then Card(modifier=Modifier) renders), red before. Design is reported to the coordinator before implementation (adds public Python meaning).

Activity

  1. added a commit that references this issue on Oct 25, 2026
  2. b-re-w commented on Oct 25, 2026

    @b-re-w
    MemberAuthor

    Landed in develop via #324. pythonx-compose can now call register_empty(Modifier, lambda: Modifier.Companion); Card(modifier=Modifier) renders the same as Card(...) in the compose fixture.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions