This project exists solely to debug and hopefully solve a problem I'm having with Pluto.jl notebooks.
module ProblematicAnimals
abstract type AbstractAnimal end
struct Cat <: AbstractAnimal end
struct Dog <: AbstractAnimal end
sound(cat::Cat) = "meow"
sound(dog::Dog) = "bark"
# Structs defined in a notebook seem to become invisible while in this function.
function why(a::AbstractAnimal)
sound(a)
end
export AbstractAnimal
export Cat
export Dog
export sound
export why
endjulia> cat = Cat()
Cat()
julia> sound(cat)
"meow"
julia> why(cat)
"meow"struct Pig <: AbstractAnimal end
sound(pig::Pig) = "oink"
pig = Pig()
sound(pig) # "oink"
why(pig) # The `sound(pig::Pig)` function is invisible to the why(a) function.- The answer was so simple.
ProblematicAnimals.sound(pig::Pig) = "oink"