Migrating to v0.3

v0.3.0 completes the transition from Symbol-based APIs to fully typed dispatch. Most migrations are mechanical find-and-replace operations — all breaking changes produce compile-time errors, so your test suite will catch everything.

Factory Functions

v0.3 introduces Search(), Extrap(), and Side() factory functions as the recommended high-level API. These are shorter to type and easier to discover than the concrete types. See Factory Functions for details.

Quick Search-Replace Reference

Run these replacements across your codebase. Order matters for partial-match safety.

Extrapolation (Symbols → Types)

v0.2 (removed)v0.3 (factory)v0.3 (direct type)
extrap=:noneextrap=Extrap(:none)extrap=NoExtrap()
extrap=:constantextrap=Extrap(:constant)extrap=ConstExtrap()
extrap=:extensionextrap=Extrap(:extend)extrap=ExtendExtrap()
extrap=:wrapextrap=Extrap(:wrap)extrap=WrapExtrap()
Note

The old symbol was :extension (with -ion); the new factory symbol is :extend (shorter, matches the type name better).

Also removed: ParabolaFit() → use QuadraticFit().

Side Selection (Symbols → Types)

v0.2 (removed)v0.3 (factory)v0.3 (direct type)
side=:nearestside=Side(:nearest)side=NearestSide()
side=:leftside=Side(:left)side=LeftSide()
side=:rightside=Side(:right)side=RightSide()

Derivatives (Int/Val → DerivOp)

v0.2 (removed)v0.3
deriv=0deriv=DerivOp(0) or EvalValue()
deriv=1deriv=DerivOp(1) or EvalDeriv1()
deriv=2deriv=DerivOp(2) or EvalDeriv2()
deriv=3deriv=DerivOp(3) or EvalDeriv3()
deriv=Val(n)deriv=DerivOp(n)
deriv=(1, 0)deriv=DerivOp(1, 0)
deriv=Val((1, 0))deriv=DerivOp(1, 0)

The old alias names (EvalValue, EvalDeriv1, EvalDeriv2, EvalDeriv3) remain exported and work unchanged.

Boundary Conditions (Renames)

v0.2 (removed)v0.3
NaturalBC()ZeroCurvBC() — S''=0 at boundaries
ClampedBC()ZeroSlopeBC() — S'=0 at boundaries

Default BC changed: cubic_interp(x, y) now uses CubicFit() (was ZeroCurvBC()). To preserve the old behavior:

itp = cubic_interp(x, y; bc=ZeroCurvBC())  # explicitly specify old default
CubicFit minimum grid size

CubicFit() requires ≥ 4 grid points. For 3-point grids, use bc=ZeroCurvBC().

Search Policies (Renames)

v0.2 (removed)v0.3 (factory)v0.3 (direct type)
Binary()Search(:binary)BinarySearch()
Linear()Search(:linear)LinearSearch()
LinearBinary()Search(:linear_binary)LinearBinarySearch()
LinearBinary{4}()Search(:linear_binary; linear_window=4)LinearBinarySearch{4}()
HintedBinary()LinearBinarySearch(linear_window=0)

Behavioral Changes (Non-Breaking)

Default Search Policy: AutoSearch

The default search policy changed from BinarySearch() to AutoSearch(). Existing code compiles without changes, but runtime behavior differs for vector queries:

Query Typev0.2 Defaultv0.3 DefaultEffect
ScalarBinarySearch()BinarySearch() (via AutoSearch)No change
Sorted vectorBinarySearch()LinearBinarySearch() (via AutoSearch)Faster (up to ~5×)
Random vectorBinarySearch()LinearBinarySearch() (via AutoSearch)Slower (~2–3×)

If you have random vector queries and observe slowdowns, restore v0.2 behavior explicitly:

itp = cubic_interp(x, y; search=Search(:binary))
# or
itp = cubic_interp(x, y; search=BinarySearch())

Detailed Examples

Extrapolation

# ─── v0.2 (removed) ──────────────────────────────
cubic_interp(x, y, xq; extrap=:constant)
linear_interp(x, y, xq; extrap=:extension)

# ─── v0.3 (recommended: factory) ─────────────────
cubic_interp(x, y, xq; extrap=Extrap(:constant))
linear_interp(x, y, xq; extrap=Extrap(:extend))

# ─── v0.3 (alternative: direct type) ─────────────
cubic_interp(x, y, xq; extrap=ConstExtrap())
linear_interp(x, y, xq; extrap=ExtendExtrap())

# ─── ND per-axis (new variadic form) ─────────────
cubic_interp((x, y, z), data; extrap=Extrap(:extend, :constant, :none))

Side Selection

# ─── v0.2 (removed) ──────────────────────────────
constant_interp(x, y, xq; side=:left)

# ─── v0.3 ────────────────────────────────────────
constant_interp(x, y, xq; side=Side(:left))
constant_interp(x, y, xq; side=LeftSide())

# ─── ND per-axis ─────────────────────────────────
constant_interp((x, y), data; side=Side(:left, :nearest))

Derivatives

# ─── v0.2 (removed) ──────────────────────────────
cubic_interp(x, y, xq; deriv=1)
itp(q; deriv=Val((1, 0)))

# ─── v0.3 ────────────────────────────────────────
cubic_interp(x, y, xq; deriv=DerivOp(1))
itp(q; deriv=DerivOp(1, 0))

Boundary Conditions

# ─── v0.2 (removed) ──────────────────────────────
cubic_interp(x, y; bc=NaturalBC())
cubic_interp(x, y; bc=ClampedBC())

# ─── v0.3 ────────────────────────────────────────
cubic_interp(x, y; bc=ZeroCurvBC())    # S''=0
cubic_interp(x, y; bc=ZeroSlopeBC())   # S'=0

Search Policies

# ─── v0.2 (removed) ──────────────────────────────
linear_interp(x, y, xq; search=Binary())
linear_interp(x, y, xq; search=LinearBinary())

# ─── v0.3 (recommended: factory) ─────────────────
linear_interp(x, y, xq; search=Search(:binary))
linear_interp(x, y, xq; search=Search(:linear_binary))

# ─── v0.3 (alternative: direct type) ─────────────
linear_interp(x, y, xq; search=BinarySearch())
linear_interp(x, y, xq; search=LinearBinarySearch())

# ─── ND per-axis ─────────────────────────────────
cubic_interp((x, y, z), data; search=Search(:binary, :linear_binary, :auto))

Error Messages

v0.3 produces clear errors for old API usage:

julia> cubic_interp(x, y; extrap=:constant)
ERROR: MethodError: no method matching ...
# → Use Extrap(:constant) or ConstExtrap()

julia> cubic_interp(x, y, xq; deriv=1)
ERROR: TypeError: ...
# → Use DerivOp(1) or EvalDeriv1()

julia> linear_interp(x, y, xq; search=Binary())
ERROR: UndefVarError: `Binary` not defined
# → Use Search(:binary) or BinarySearch()

julia> Search(:bianry)
ERROR: ArgumentError: unknown search policy :bianry;
       valid options are :auto, :binary, :linear, :linear_binary
# → Factory functions show valid options on typos

Migration Checklist

  1. Update extrap kwargs — replace :symbol with Extrap(:symbol) or typed constructors
  2. Update side kwargs — replace :symbol with Side(:symbol) or typed constructors
  3. Update deriv kwargs — replace Int/Val with DerivOp(n)
  4. Update BC typesNaturalBCZeroCurvBC, ClampedBCZeroSlopeBC
  5. Update search typesBinaryBinarySearch, etc.
  6. Check default BC — if you relied on the implicit ZeroCurvBC default, specify it explicitly
  7. Check vector query performance — if using random access patterns, set search=BinarySearch() or Search(:binary)
  8. Run tests — all changes produce compile-time errors, so tests catch everything