SPICE-0020: Deferred, type-safe references#1354
Open
HT154 wants to merge 11 commits into
Open
Conversation
6bd5bfc to
14a7c24
Compare
Reyna8780
approved these changes
Jan 24, 2026
d7663a8 to
09ac8d7
Compare
c61ce90 to
0085962
Compare
ce06670 to
98a918f
Compare
Reference<T>
bioball
requested changes
May 18, 2026
ad9f40a to
f141580
Compare
This was referenced May 27, 2026
6fe701c to
17a09a0
Compare
bioball
approved these changes
Jun 5, 2026
bioball
left a comment
Member
There was a problem hiding this comment.
Approving to unblock; just some minor comments!
… Module.output, and any property of an external class
| @@ -1,5 +1,5 @@ | |||
| /* | |||
| * Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved. | |||
| * Copyright © 2024-2026 Apple Inc. and the Pkl project authors. All rights reserved. | |||
|
|
||
| /** Returns the class's containing module's class, or this class if it is a module class. */ | ||
| public PClass getModuleClass() { | ||
| return moduleClass != null ? moduleClass : this; |
Contributor
There was a problem hiding this comment.
If we are returning this we should assert it's a module class.
| return domain.equals(that.domain) | ||
| && data.equals(that.data) | ||
| && path.equals(that.path) | ||
| && referentType.equals(that.referentType); |
Contributor
There was a problem hiding this comment.
PType doesn't implement equals (or hashcode). So this would compare by reference. Not sure this would always be safe.
| refInterpolation = "${a.outputs.someListing[1]}" | ||
| kInterpolation = "new K { aId = Reference(new D {}, String, new A { name = \"a\"; id = \"some-a-value\" }).id; bId = Reference(new D {}, String, new B { name = \"b\"; id = \"some-b-value\" }).id; aProperties = Reference(new D {}, reference#AProperties, new A { name = \"a\"; id = \"some-a-value\" }).outputs; bProperties = Reference(new D {}, reference#BProperties, new B { name = \"b\"; id = \"some-b-value\" }).outputs; aValues { Reference(new D {}, Int, new A { name = \"a\"; id = \"some-a-value\" }).outputs.foo; Reference(new D {}, Int | Null, new A { name = \"a\"; id = \"some-a-value\" }).outputs.someMapping[\"key\"]; Reference(new D {}, Int, new A { name = \"a\"; id = \"some-a-value\" }).outputs.someMap[new MapKey { k = 123 }]; Reference(new D {}, Int, new A { name = \"a\"; id = \"some-a-value\" }).outputs.someListing[0]; Reference(new D {}, Int, new A { name = \"a\"; id = \"some-a-value\" }).outputs.someList[9223372036854775807]; Reference(new D {}, Int, new B { name = \"b\"; id = \"some-b-value\" }).outputs.nonString }; bValues { Reference(new D {}, String, new B { name = \"b\"; id = \"some-b-value\" }).outputs.foo; Reference(new D {}, Null | String, new B { name = \"b\"; id = \"some-b-value\" }).outputs.someMapping[\"key\"]; Reference(new D {}, String, new B { name = \"b\"; id = \"some-b-value\" }).outputs.someMap[new MapKey { k = 123 }]; Reference(new D {}, String, new B { name = \"b\"; id = \"some-b-value\" }).outputs.someListing[0]; Reference(new D {}, String, new B { name = \"b\"; id = \"some-b-value\" }).outputs.someList[9223372036854775807]; Reference(new D {}, String, new A { name = \"a\"; id = \"some-a-value\" }).outputs.nonInt }; splitUnion = null }" | ||
| aValuesJoined = """ | ||
| org.pkl.core.runtime.VmReference@<addr> |
Contributor
There was a problem hiding this comment.
Is it intended that VmReference has no toString?
| // * dereferencing aliases (except for well-known stdlib alias types) | ||
| // * flattening unions | ||
| // * when moduleClass is supplied, replace PType.MODULE with appropriate PType.Class | ||
| // * drop PType.NOTHING, PType.Function, and PType.TypeVariable |
Contributor
There was a problem hiding this comment.
You mentioned NOTHING is dropped, but normalizeTypes add it to the result.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
SPICE: apple/pkl-evolution#27
Resolves #912
[native-pkl-cli]