Tags: enetx/g
Tags
feat!: SeqResult lazy transformers are consumer-driven on Err Map, Filter, Exclude, Dedup, Unique, Skip, StepBy, Take, Chain, Intersperse, Inspect, Scan, and FlatMap no longer terminate the sequence at the first Err: the Err is yielded downstream like any other element and the source keeps iterating for as long as the consumer keeps accepting values. Previously the transformer itself returned false after yielding an Err, so a single transient error silently truncated the rest of the stream even when the consumer wanted to skip it. Fail-fast is now exclusively the consumer's choice, matching the Rust idiom (itertools map_ok/filter_ok + try_* terminals): - break on the Err element (yield returns false), or - use the short-circuiting terminals — TryCollect, Fold, Reduce, All, Any, First, Find, Nth — whose behavior is unchanged. Err elements stay transparent to transformer logic: Take/Skip count only Ok elements, Dedup/Unique exclude Err from comparison state, Intersperse emits no separator around an Err. Tests: new result_iter_errcont_test.go covers continuation for all 13 transformers plus guards locking consumer-break and TryCollect fail-fast; the two tests that encoded the old terminate-on-Err contract (FlatMap cross-type, ErrSeq Chain) now assert both sides — continuation under a continuing consumer and fail-fast under a breaking one.
feat!: Go 1.27 generic methods — type-changing chains, jsonv2, checke…
…d math, API consolidation
BREAKING CHANGES:
- require Go 1.27: iterator and monad chains change payload type in-chain
(Map[U], Then[U], ThenOf[U], FilterMap[U], FlatMap[U], Fold[A], Scan[A],
MapOr[U]); Transform[U] is a universal pipe on every wrapper type
- drop pre-1.27 workarounds: TransformSlice/TransformSet/TransformOption/
TransformResult(Of), MapOption, MapSeqResult, FlattenResult, package-level
Flatten and Counter, Slice.AsAny, eager Slice.Map/Set.Map, Int.Wrapping*,
Slice.MaxBy/MinBy, SeqHeap.Eq, Option.Result alias, Int.IsNonNegative
- Zip is fully typed: Zip[U](other) -> SeqPairs[V, U]; SeqPairs.Collect returns
[]Pair by design (generic-method instantiation cycle)
- Split(sep) requires an explicit separator (String and Bytes); Chars() is the
canonical per-rune iteration
- Int.IsPositive is strict (> 0); String.TryBigInt returns Result;
GroupBy renamed to ChunkBy (Rust slice::chunk_by semantics);
File/Dir Exist -> Exists; Dir.Temp/Dir.CreateTemp -> package TempDir/
CreateTempDir; pool.Reset panics while tasks are running
- JSON is encoding/json/v2: Option/Result implement MarshalJSONTo/
UnmarshalJSONFrom; invalid UTF-8 and duplicate object keys are rejected;
nil slices marshal as []; Slice.Set returns Option instead of panicking
Added:
- Int checked/saturating/overflowing arithmetic, Clamp, Signum, Neg;
Float math and classification (IsNaN/IsInf/IsFinite/IsNormal, Signum,
Ceil/Floor/Trunc/Fract, Clamp, Recip, Copysign, MulAdd (FMA), Hypot, Cbrt,
Exp/Ln families, trig, ToDegrees/ToRadians, IsSignPositive/IsSignNegative)
- Result JSON ({"ok": v} / {"err": "msg"}); Result Or/OrElse/IsOkAnd/IsErrAnd/
InspectErr/UnwrapErr/MapOr/MapOrElse; Option MapOr/MapOrElse/IsNoneOr/ThenOf
- Bytes<->String parity: JSON/URL/HTML/Rot13/Octal codecs; byte-wise Cut,
Similarity, Truncate, LeftJustify/RightJustify/Center, IsASCII, IsDigit,
Chunks, SubBytes, ReplaceMulti, Remove, ReplaceNth; Runes -> Slice[rune]
- adapters: TakeWhile/SkipWhile across all seq types; CounterBy[K];
FilterByKey/FilterByValue (SeqMap/SeqMapOrd/SeqPairs); SeqResult TryCollect/
Fold/Reduce/Scan/FlatMap/Map[U]; SeqSet First/Last/StepBy/MaxBy/MinBy/Chan/
CounterBy/Difference/Intersection/Partition; SeqMap(Ord) All/Any/Last/Chan/
Fold/FilterMap; full SeqPairs surface
- constructors MapOf/MapOrdOf/HeapOf/PairOf; f.Id; Set.Disjoint; Heap.Eq/Ne
- package documentation (doc.go), CHANGELOG.md, fuzz targets,
CI pinned to Go 1.27.0-rc.1
Fixed:
- SubSlice crash with negative step at start == len (Python slicing semantics)
- SeqMapOrd.Collect and MapOrdOf were O(n^2), now O(n); OrdEntry caches its
index instead of rescanning per operation
- format engine no longer invokes zero-return methods via reflection
- SQL driver conversion guards uint > MaxInt64; Result.Expect reports caller;
deque/pool/heap panic messages normalized with package prefixes
- examples restructured to one program per directory (go build ./... clean)
refactor(print): replace .type/.debug/.wrap modifiers with format spe…
…c verbs
- Add print_fmt.go with Rust-style format mini-language ({:x}, {:>10.2}, {:+05}, etc.)
- Replace .type with {:T}, .debug with {:?}, .wrap with {:w} verb
- Support alignment (<, >, ^), fill, sign (+, -, space), zero-pad, width, precision
- Support verbs: x/X (hex), o (octal), b (binary), e/E (exponential), ? (#? pretty), T, p, w
feat(option): add Filter, Or, OrElse, IsSomeAnd and mutating methods - Add Filter for conditional value filtering - Add Or/OrElse for providing fallback Options - Add IsSomeAnd to check value against predicate - Add Insert, GetOrInsert(+With) for mutable value management - Add Take and Replace for value extraction/swap - Add OkOr/OkOrElse to convert Option to Result - Add FromPtr and Ptr for pointer conversions
PreviousNext