mirror of
https://github.com/apple/pkl.git
synced 2026-01-13 07:10:41 +01:00
Creating a Dynamic with property default set produces a broken object
#175
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @HT154 on GitHub (Jun 29, 2024).
The behavior as-is is very surprising! Check this out:
Result:
I think throwing an error (or at least some kind of warning) here instead of returning unexpected results is desirable. Something like "encountered object key
defaultwhen parsing JSON, resultingDynamicwill be incomplete or invalid" might make sense.N.B.: Attempting to access the default yields further surprises:
Result:
This similarly affects
yaml.Parser.parse()andMap.toDynamic().@bioball commented on GitHub (Jul 3, 2024):
Fair issue; seems like a good idea to throw here instead.
@lemonnn-8 commented on GitHub (Aug 24, 2024):
Hey, I can take this up.
@HT154 commented on GitHub (Feb 7, 2025):
This actually doesn't just affect JSON/YAML parsing. It also affects
Map.toDynamic():