#30492

stdlib parity wave 2: API-level gap tracking

Openmetif12opened 16d ago

Summary

Tracking issue for wave 2 of the stdlib parity program — API-level (not module-level) gaps found by a deeper cross-language comparison against Rust std, Go std, Zig std, Odin core, Python stdlib and Node. Method and raw data: public-API inventories built from source and name-normalized against vlib's 7,984 library names across 501 modules; wave-1-shipped names excluded.

Prior art: #639 (closed), #30345 (wave-1 tracking). No duplicates found for any item below (searches run before filing).

Issues

  • #30482 math.stats: variance/stdev/quantiles/correlation + normal distribution
  • #30483 datatypes: heapq-compatible heap API
  • #30484 arrays: bisect_left/right + insort_left/right
  • #30485 math: lgamma, remainder, fma, classify, next_power_of_two, to_degrees…
  • #30486 strings/arrays: cut, split_after, equal_fold, index_byte, is_sorted…
  • #30487 io: reader combinators (read_byte, read_full, limited/tee/multi/section)
  • #30488 os: same_file, is_absolute, copy_file, user_*_dir, volume_name…
  • #30489 strconv.parse_bool + time add_date/weekday/clock
  • #30490 rand: Zipf distribution
  • #30491 difflib: unified/context/ndiff + get_close_matches

Each issue carries verified-absent evidence (names grepped in the vlib tree), a V-idiomatic API proposal, and a red-first test plan; each PR lands new files with v test / v fmt -verify / v missdoc / module-suite gates.

Deliberately excluded (verified not real gaps)

  • Name-only aliases: hasprefix↔starts_with, basename↔os.base, extension↔os.file_ext, itoa↔str, month/year↔Time fields
  • Inflated counts from Odin/Zig typed variants, compiler internals, Python internals (functools comparison wrappers, shutil _fastcopy block sizes)
  • Language-coupled design: Rc/Arc (sync.arc shipped in #30361), is_dst (needs timezone rules — noted as follow-up in #30489), read_at (needs a read_at method on os.File — noted as follow-up in #30487)

Activity

1
metif1216d ago

Final status: wave 2 complete (10/10)

IssueImplementationPR
#30482 math.stats: correlation/linear_regression/quantiles/multimode/NormalDistmath/stats/regress.v#30506
#30483 heapq-compatible heap APIdatatypes/heapq.v#30508
#30484 bisect_left/right + insort_left/rightarrays/bisect.v#30496
#30485 lgamma, remainder, fma, classify, next_power_of_two…math/float_ops.v#30499
#30486 split_after, equal_fold, last_index_any, contains_rune, is_sortedstrings/text_ops.v, arrays/is_sorted.v#30501
#30487 read_byte/read_full + limited/tee/multi/section_readerio/reader_ops.v#30509
#30488 same_file, is_absolute, is_path_separator, copy_file, user_*_dir, volume_nameos/path_ops.v, os/same_file_windows.c.v#30516
#30489 strconv.parse_bool + time weekday/add_date/clockstrconv/parse_bool.v, time/date_ops.v#30518
#30490 rand: Zipf distributionrand/zipf.v#30527
#30491 difflib → only get_close_matches was a real gapstrings/close_matches.v#30535 (closed)

What verification changed (documented in each PR)

Name-level comparison said these were missing; source verification showed several already existed under other names, and each PR shipped only the real gap:

  • variance/stdev/quantile/covariance → population_variance, sample_stddev, quantile, covariance in math.stats
  • cut → string.split_once; split_lines → split_into_lines; index_byte → index_u8; has_prefix → starts_with
  • unified/context diffs → vlib/arrays/diff.generate_patch; similarity → strings.similarity (Levenshtein/Dice/Jaro-Winkler)

Cross-cutting findings worth remembering

  • os.cp creates hard links — "a copy is a distinct object" needs a real read/write copy in tests.
  • CLOSED __global / init() in vlib: a __global breaks every in-module test in the same module (calrified during the park/unpark work).
  • Month conventions differ inside vlib/time: days_from_unix_epoch uses Hinnant's March-based months and days_in_month takes (month, year).
  • Interface boxing copies struct values; pass pointers to share state, and note strings.Builder does not satisfy io.Writer from another module.

All 10 PRs are open on metif12/v branches against vlang/v:master, each with red-first-proven tests and the v test / v fmt -verify / v missdoc gates.