Why pure Go¶
go-ruby-ipaddr/ipaddr reimplements Ruby's IPAddr in pure Go, with cgo disabled. The
slice of Ruby it covers is deterministic and interpreter-independent: given
its inputs, the result is a pure function of those inputs — no live binding, no
evaluation of arbitrary Ruby. That is exactly the part that can — and should —
live as a standalone Go library, separate from the interpreter.
Bound by rbgo, reusable by anyone¶
This library is bound into go-embedded-ruby's
rbgo as a native module — the same pattern as go-ruby-regexp and go-ruby-erb — so that:
- any Go program can import
github.com/go-ruby-ipaddr/ipaddrdirectly, with no Ruby runtime; - the dependency runs the other way —
rbgobinds this module, rather than this module depending on the interpreter; - the behaviour is pinned by a differential oracle against the system
ruby, independent of any one consumer.
Why pure Go matters here¶
Because the library is CGO-free and dependency-free, it:
- cross-compiles to every Go target with no C toolchain, and links into a single static binary;
- has no dependency on the Ruby runtime — the dependency runs the other way;
- can be differentially tested against the
rubybinary wherever one is onPATH, while the cross-arch lanes (whererubyis absent) still validate the library itself.
See Usage & API for the surface and Roadmap for what is in scope.