carvel-dev / carvel-dev/ytt

"Port" over Starlark's native `struct` features to `ytt`'s custom implementation

Open
#220 1 comment 0 reactions 0 assignees View on GitHub
discussion
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

Open the contributing 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.