[SOLVED] Unexpected dispatch behavior

question and broken code removed

Please provide a Minimal Working Example (MWE) so that we can run the code and see where it is going wrong. The code you gave is using undefined types and functions, in particular the following are missing:

  • Empty
  • WithinLength
  • isfull
  • _next_circ_idx

You might also want to read: Please read: make it easier to help you

Anyways, if I define some of the missing pieces like

struct Empty{T} <: FillingLevel end
struct WithinLength{T} <: FillingLevel end
isfull(cb::CircularBuffer) = cb.tail >= length(cb.queue)-1

I get the following error

julia> push!(cb1,3,4,5)
ERROR: UndefVarError: _next_circ_idx not defined
 [1] _push!(::CircularBuffer{Int64}, ::Int64, ::Vararg{Int64})
   @ Main ~/wd/scratch/julia/mwe_bombusfragrans.jl:123

In the bits of code I have from you _next_circ_idx only appears in the definition of _push, so to me it seems to work correctly.
Maybe just try to restart the REPL and run your script again?

First: thanks for trying. Very sorry! Should have been a working example. My bad.

Very sorry again. Should not have happened. Something got really mixed up…

Very sorry again. Should not have happened.

No worries!
The PSA above only says that preparing a MWE makes it simpler for others to help.
But sometimes it can also help yourself solve the problem immediately.
Also: I am not saying you should not ask questions here, they are always welcome :).

So what solved the issue in the end?

Btw: You would not have needed to delete the question.


Sorry, it was not my intention to waste your time! I actually read the PSA and thus the non-working MWE ws a bit embarrassing… should not have happened.
Not to confuse others I deleted the code.
I obviously had same serious tunnel vision. a recursion further down caused the unexpected behaviour…