"Port" over Starlark's native `struct` features to `ytt`'s custom implementation
- Dominant language
- Go
- Stars
- 1.9k
- Forks
- 167
- PR merge metrics
- No merged PRs in 30d
Description
Starlark's struct has some features we should port over to the `ytt` implementation of this data structure. Doing so avoids any surprises that arise from an enterprising user seeing the Starlark struct in use, somewhere, and attempting to mimic such expressions in their `ytt` templates/programs.
Starlark’s struct:
- triggers adding a hint when an attribute is not found by returning an `starlark.NoSuchAttrError`
- implements `HasBinary` — allowing for `+` to merge two structs
- participates in freezing
also, there are other Starlark features that `struct` could opt-in on:
- `HasSetField`/`HasSetIndex` allows unfrozen structs to be mutable (currently, you’d have to decode, convert and encode)
- fine point: this depends on implementing freezing so that modifications to Data Values fails fast.
Contributor guide
Research direction
No files or tests are named. Start by locating ytt’s custom struct implementation and compare it with the Starlark struct protocols listed in the issue. Done means the relevant missing-attribute hints, struct merging, freezing, and optional mutation behavior are implemented with coverage for each supported feature.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100