From the blooper reel

Excerpt from some test code I wrote that had me staring at the screen for a while, trying to locate the error.

N = 2

# about 200 lines later, in a galaxy far, far away…

my_test_utility(::Val{N}, various_arguments...) = :so_elegant # note missing where N

@testset "test all dimensions" begin
    for N in 1:10
        my_test_utility(Val(N), "a fish") # no method matching my_test_utility(::Val{1}, ::String)
    end
end

Want to clarify: this is my error, not a problem with Julia in any way whatsoever. I just found it funny.

Only while trying to understand what is so funny about this I finally learnt (I hope) the idea behind Val (I used to avoid it because my grandma always warned me never to trust a Val unless you know where she’s from).

:rofl: