Awesome
EponymTuples
Julia package for deconstructing dispatch on NamedTuple
s.
Uses the variable names both for the NamedTuple
and deconstruction.
Allows replacing
f((a, b)::NamedTuple{(:a, :b), <: Tuple{Any, Int}}) = ...
(a = a, b = b, c = 3)
with
f(@eponymargs(a, b::Int)) = ...
@eponymtuple(a, b, c = 3)
It is pretty lightweight: @eponymargs
and @eponymtuple
are the only symbols exported; and the package has no dependencies.
The package is registered, install with
pkg> add EponymTuples