mirror of
https://github.com/apple/pkl.git
synced 2026-01-11 22:30:54 +01:00
Stack overflow when parameter name is same as object property name #145
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 @sin-ack on GitHub (Apr 22, 2024).
The following fails:
With the following error:
The following works as expected, however:
I would expect object properties to be in a different "namespace" and such not cause a self-assignment.
@holzensp commented on GitHub (Apr 23, 2024):
You might expect that, but does that mean you'd also expect that as soon as you're inside a function, you can't reference object properties at all anymore? How would you write this?
@sin-ack commented on GitHub (Apr 26, 2024):
Hmm, you are right. Then the issue becomes "it should give a nice error instead of stack overflowing" :)
@gian-didom commented on GitHub (Jun 15, 2024):
Bumped into this
@holzensp commented on GitHub (Jun 19, 2024):
This is something to get used to, but it's rather unavoidable, given Pkl's dynamic name resolution. In a general sense, this is indistinguishable from a stack overflow (even though this direct case seems obvious; it doesn't generalise and most "real" scenarios involve at least one indirection). I'd argue the stack overflow is already kind of nice, in that it shows what the loop was explicitly.
Closing this for lack of further specificity.