Skip to content

Binder: proxy class as an object argument means its empty value (#308) - #312

Merged
b-re-w merged 1 commit into
developfrom
feat/binder-proxy-class-empty
Oct 25, 2026
Merged

b-re-w merged 1 commit into
developfrom
feat/binder-proxy-class-empty

Conversation

@b-re-w

@b-re-w b-re-w commented Oct 25, 2026

Copy link
Copy Markdown
Member

Closes #308

  • Rule (leader-approved, generic): in _coerce, when an OBJECT parameter receives a proxy class whose type matches (_is_a), the argument is Cls.empty(). The binder contains no Compose name.
  • Without a registered factory, empty()'s TypeError, which names register_empty, propagates. An unrelated class is refused as before. Overload voting counts only the type match and does not call Kotlin.
  • The temporary wrapper is pinned by _EmptyArgument for the duration of the call (same convention as _BoxedArgument).
  • SPEC U-7: Cls == Cls.empty(). It equals omitting the argument only where Kotlin's default is that value. Registering Modifier's factory belongs to pythonx-compose (relayed by the coordinator).
  • Tests:
    • PythonxAdapterTest.aProxyClassPassedAsAnObjectArgumentIsItsEmptyValue covers (a) the empty value, (b) no factory, (c) an unrelated type, (d) voting. It is red against the old PythonxAdapter.kt.
    • ProxyClassArgumentRenderTest renders Card(modifier=Modifier) the same as Card(modifier=Modifier.empty()).
  • Results: full python-multiplatform desktopTest passes with 0 failures. The compose fixture passes 124/124. androidNative compiles.

…mpty value (#308)

Generic rule, no Compose name in the binder: an OBJECT parameter that receives a proxy class of a
matching type gets Cls.empty() (a registered register_empty factory); without one, empty()'s
TypeError names register_empty. Trial binds only vote on the type. The temporary wrapper is pinned
for the call. SPEC U-7 records Cls == Cls.empty(), and == omission only where Kotlin's default is
that value. Registering Modifier's factory is pythonx-compose's.
@b-re-w
b-re-w merged commit 2ae4aab into develop Oct 25, 2026
@b-re-w
b-re-w deleted the feat/binder-proxy-class-empty branch October 25, 2026 10:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant