Adds a toMixin() method to the Object class that converts an Object
into a Mixin function applicable via the pipe operator (|>).
A generic toMixin() method cannot be implemented in user land, so this
implementation provides a native method that properly handles:
Property merging and overriding
Element appending with correct index offsetting
Entry merging with proper key handling
Nested object replacement vs amendment semantics
Implementation uses the source Object's enclosing frame to ensure
proper module context for type resolution during member evaluation.
edit: updated from Dynamic to Object
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.
## 📋 Pull Request Information
**Original PR:** https://github.com/apple/pkl/pull/1257
**Author:** [@Mikulas](https://github.com/Mikulas)
**Created:** 10/27/2025
**Status:** 🔄 Open
**Base:** `main` ← **Head:** `tomixin`
---
### 📝 Commits (1)
- [`84e495a`](https://github.com/apple/pkl/commit/84e495a638cf71c479f478fa2e224cd27255520a) Add Object.toMixin() method
### 📊 Changes
**7 files changed** (+1055 additions, -5 deletions)
<details>
<summary>View changed files</summary>
➕ `pkl-core/src/main/java/org/pkl/core/ast/ObjectToMixinNode.java` (+150 -0)
➕ `pkl-core/src/main/java/org/pkl/core/stdlib/base/ObjectNodes.java` (+41 -0)
➕ `pkl-core/src/test/files/LanguageSnippetTests/input/api/objectToMixin.pkl` (+339 -0)
➕ `pkl-core/src/test/files/LanguageSnippetTests/output/api/objectToMixin.pcf` (+218 -0)
📝 `pkl-core/src/test/files/LanguageSnippetTests/output/api/reflectedDeclaration.pcf` (+290 -4)
📝 `pkl-core/src/test/kotlin/org/pkl/core/ReplServerTest.kt` (+2 -0)
📝 `stdlib/base.pkl` (+15 -1)
</details>
### 📄 Description
Adds a `toMixin()` method to the `Object` class that converts an `Object`
into a `Mixin` function applicable via the pipe operator (`|>`).
A generic `toMixin()` method cannot be implemented in user land, so this
implementation provides a native method that properly handles:
- Property merging and overriding
- Element appending with correct index offsetting
- Entry merging with proper key handling
- Nested object replacement vs amendment semantics
Implementation uses the source `Object`'s enclosing frame to ensure
proper module context for type resolution during member evaluation.
**edit:** updated from `Dynamic` to `Object`
---
<sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
📋 Pull Request Information
Original PR: https://github.com/apple/pkl/pull/1257
Author: @Mikulas
Created: 10/27/2025
Status: 🔄 Open
Base:
main← Head:tomixin📝 Commits (1)
84e495aAdd Object.toMixin() method📊 Changes
7 files changed (+1055 additions, -5 deletions)
View changed files
➕
pkl-core/src/main/java/org/pkl/core/ast/ObjectToMixinNode.java(+150 -0)➕
pkl-core/src/main/java/org/pkl/core/stdlib/base/ObjectNodes.java(+41 -0)➕
pkl-core/src/test/files/LanguageSnippetTests/input/api/objectToMixin.pkl(+339 -0)➕
pkl-core/src/test/files/LanguageSnippetTests/output/api/objectToMixin.pcf(+218 -0)📝
pkl-core/src/test/files/LanguageSnippetTests/output/api/reflectedDeclaration.pcf(+290 -4)📝
pkl-core/src/test/kotlin/org/pkl/core/ReplServerTest.kt(+2 -0)📝
stdlib/base.pkl(+15 -1)📄 Description
Adds a
toMixin()method to theObjectclass that converts anObjectinto a
Mixinfunction applicable via the pipe operator (|>).A generic
toMixin()method cannot be implemented in user land, so thisimplementation provides a native method that properly handles:
Implementation uses the source
Object's enclosing frame to ensureproper module context for type resolution during member evaluation.
edit: updated from
DynamictoObject🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.