Instead, create a built-in singleton value absent (similar to null), which would remove the corresponding member from the object:
dodo {
name = "Dodo"
extinct = true
}
dodoWithoutName = (dodo) {
name = absent
}
Originally created by @EugZol on GitHub (Jun 24, 2024).
Currently in the language reference the following solution for removing fields is recommended:
```pkl
// https://pkl-lang.org/main/current/language-reference/index.html#transforming-objects
dodo {
name = "Dodo"
extinct = true
}
dodo
.toMap()
.remove("name")
.toDynamic()
```
Instead, create a built-in singleton value `absent` (similar to `null`), which would remove the corresponding member from the object:
```
dodo {
name = "Dodo"
extinct = true
}
dodoWithoutName = (dodo) {
name = absent
}
```
Something similar has been discussed in the past using the delete keyword in the context of member predicates for amending Listings/Mappings. In terms of naming, I'm personally partial to omit, which is what Ansible uses for a similar action.
@HT154 commented on GitHub (Jun 30, 2024):
Something similar has been discussed in the past using the `delete` keyword in the context of member predicates for amending Listings/Mappings. In terms of naming, I'm personally partial to `omit`, which is what Ansible uses for a similar action.
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.
Originally created by @EugZol on GitHub (Jun 24, 2024).
Currently in the language reference the following solution for removing fields is recommended:
Instead, create a built-in singleton value
absent(similar tonull), which would remove the corresponding member from the object:@HT154 commented on GitHub (Jun 30, 2024):
Something similar has been discussed in the past using the
deletekeyword in the context of member predicates for amending Listings/Mappings. In terms of naming, I'm personally partial toomit, which is what Ansible uses for a similar action.