Answer prose round 1: say item 26 revises the clock decision, fold the direction into its first step, and leave narrowing and the seed to their own items

This commit is contained in:
2026-10-04 20:28:50 +02:00
committed by Lillem4n
parent 32c1fb6c26
commit f3fcf569ad
2 changed files with 4 additions and 5 deletions
+3 -4
View File
@@ -257,10 +257,9 @@ GoReleaser attaches the binaries to the release the tag workflow publishes, and
### 26. Spell `sv_SE.personnummer` with the `+` Skatteverket uses from the year the holder turns 100, judged by a date the caller gives.
The format hard-codes `-`, and its earliest birthdate, 1930-01-01, makes the oldest draws invalid from 2030. A system holding Swedish personnummer often breaks on the `+`, so a fixture carrying one is a valuable test. Whether a number takes `+` depends on the date it is read, and the decision "No builtin reads the clock, so a date is bounded by days, never by an age" forbids a builtin from reading that date off the clock. Explore the first step before the rest:
- Explore how a caller passes input data, such as the date a number is read on, to a render: in the template, as a plain option, or both. Bench the spelling; `--now` reads like the clock, and only the year counts. The same input can narrow what is drawn: only adults, only children, only 65 and over, or a mix. That also covers a test asking for a centenarian.
- The maintainer's direction, 2026-10-04: the library requires every input that can change, such as the date and the randomness, and the CLI defaults to the system's when its flag is absent. Today `New` without `WithSeed` draws its own randomness, so this reaches beyond the date.
- Draw birthdates far enough back that a `+` can appear today. Read in 2026, the oldest shipped birthdate is 96 years old, so no draw carries a `+` until 2030. Skatteverket's test series reaches back to 1890, with birth numbers 980/981 before 1900. Draw no birthdate after the given date.
The format hard-codes `-`, and its earliest birthdate, 1930-01-01, makes the oldest draws invalid from 2030. A system holding Swedish personnummer often breaks on the `+`, so a fixture carrying one is a valuable test. Whether a number takes `+` depends on the date it is read, and the decision "No builtin reads the clock, so a date is bounded by days, never by an age" forbids a builtin from reading that date off the clock. This item revises it: once the caller gives the date, an age is a bound, and the CLI's default date makes output change with the day it runs unless the flag is given. Do the first step before the rest:
- Explore how a caller passes input data, such as the date a number is read on, to a render: in the template, as a plain option, or both. The library requires every input that can change, such as the date and the randomness; the CLI defaults to the system's when its flag is absent. Bench the spelling; `--now` reads like the clock. Shape the input so it can later narrow the draws to adults, children, 65 and over, or a mix, and so let a test ask for a centenarian; narrowing itself waits for its own item. Requiring the randomness changes `New`, which today seeds itself without `WithSeed`; split that into its own item when this one is picked.
- Draw birthdates back past 100 years before the given date, so a `+` can appear. Read in 2026, the oldest shipped birthdate is 96 years old, so no draw carries a `+` until 2030. Skatteverket's test series reaches back to 1890, with birth numbers 980/981 before 1900. Draw no birthdate after the given date.
- Weight the ages by the territory's population, so the share of `+` numbers follows its demography: [research-age-bands.md](docs/research/research-age-bands.md).
- Let a data author's own category spell the separator too, through a builtin or a function a data module provides (item 77), and update the README's personnummer recipe and its "a day in 1930–2025" count.
- Research: `sv_SE.samordningsnummer` also hard-codes `-` and draws from 1930. Check whether Lag (2022:1697) om samordningsnummer gives it the same `+`; folkbokföringslagen 18 § states the rule for personnummer only.