-
Notifications
You must be signed in to change notification settings - Fork 281
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Entry of which key is same with an element index #361
Comments
Currently, there is a bug when mixing entries whose keys are integers with elements. So, the first snippet is incorrect, and is a bug. This happens because Pkl mistakenly interprets |
Thank you and I understood. |
What does |
Currently, the behavior is: if there is an element at index With our current behavior, I think this should throw with a duplicate member definition error. It doesn't make sense for this to be accepted as one element declaration:
I think there's some room for improvement here. This is surprising:
This produces:
Possibly, we can change the grammar for "assign to element index N", which might help here. For example, here's some made up syntax:
|
Is it expected behavior that Pkl raise an error if an entry and an element have the same idnex? |
Pkl's behavior for dynamic objects that contain both elements and integer-keyed entries is confusing. I think it cannot even be reasoned about because a key with index I can think of several solutions, but one stands out for being simple to understand and implement:
This would also solve the following oddities:
Are there legitimate use cases for supporting dynamic objects that contain both elements and entries? |
Hi,
As shown example below, entries of which key matches with an element index will be deleted.
On the other hand, entries of which key does not match with an element index will not be deleted.
Which behavior is wrong?
The text was updated successfully, but these errors were encountered: