Skip to content

Type-level varargs support (type IsRepeated) #55

@halotukozak

Description

@halotukozak

Follow-up to #53 (repeated-metadata).

Varargs currently surface via @repeated injected into Metadata — queryable through
hasAnnotation[repeated]. Type-level dispatch on varargs requires reading the metadata
tuple structurally.

Proposal (shape TBD)

Maybe introduce dedicated type member on MadeFieldElem:

type IsRepeated <: Boolean & Singleton
def isRepeated: IsRepeated

Would enable type-level dispatch in match types and derivation without scanning Metadata.

Why deferred

  • @repeated covers introspection
  • Mirror normalizes varargs to Seq[T] so existing builders (fromTuple, fromUnsafeArray)
    work without flag
  • Niche use case (positional codecs that branch construction by repeated-ness)
  • Adding new type member is breaking refinement change — needs concrete demand

Revisit when a positional codec / DSL builder needs to branch on varargs at the type level.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions