# Package Proposal: ExperimentNumber.jl - annotating an integer with a label to allow dispatch on label

**URL:** <https://discourse.julialang.org/t/package-proposal-experimentnumber-jl-annotating-an-integer-with-a-label-to-allow-dispatch-on-label/130374>\
**Category:** Package Announcements\
**Tags:** package, proposal, idea\
**Created:** [July 1, 2025, 2:58pm UTC](https://discourse.julialang.org/t/package-proposal-experimentnumber-jl-annotating-an-integer-with-a-label-to-allow-dispatch-on-label/130374 "2025-07-01T14:58:21Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![gmcardle](https://avatars.discourse-cdn.com/v4/letter/g/34f0e0/32.png) [@gmcardle](https://discourse.julialang.org/u/gmcardle)\
**Post date:** [July 1, 2025, 2:58pm UTC](https://discourse.julialang.org/t/package-proposal-experimentnumber-jl-annotating-an-integer-with-a-label-to-allow-dispatch-on-label/130374/1 "2025-07-01T14:58:22Z")

</div>

I’m currently making a small module to scratch an itch but wondered if it would be of wider use and worth going the extra step of publishing it.  
My primary use case is to be able to pass the run number of a given experiment type to a function call, but define multiple methods for that function based on the experiment type. So we could call a function, say `getResults(runNo)` but we can define methods like

```julia
getResults(runNo::ExperimentNumber{:mine}) = doMyThing(Integer(runNo))
getResults(runNo::ExperimentNumber{:yours}) = doYourThing(Integer(runNo))

```

I’ve not made a public package before so I thought this might be a simple place to start, but given how lightweight the current definition is, does it even justify being a package, and/or is there a built-in julia feature or published package that already does this?

FYI, The essence of the package is the type definition:

```julia
struct ExperimentNumber{E} <: Integer
    i::Integer
    @inline ExperimentNumber(E::Symbol, i::Integer) = new{E}(i)
end

```

That’s pretty much it! The rest is just some overloading of Base methods for type conversion etc. as far as may be useful or necessary.

Comments, suggestions, feedback welcome!
