Pluto.jl - How do I dispatch to a subtype created in a notebook?

The problem is the definition of the method sound in the notebook. See this section of the manual: Modules · The Julia Language

The code in the linked notebook defines a new function Main.sound rather than implementing a new method for ProblematicAnimals.sound. You have two choices to fix it, the easiest is to fully qualify the name when defining the new method.

ProblematicAnimals.sound(pig::Pig) = "oink"

The other is to import that method as described in the manual in the block at the top of the notebook.

2 Likes