The Julian way to solve this is to use composition over inheritance. This has been discussed in this thread.
I am also with Tamas; if I saw a source file with hundreds of such structs (mutable even!), it would strongly suggest to me that there are better ways to do it. (Although I’m sure there are rare exceptions.)
For the example you mention, you could imagine binding the process
function to the fruit:
struct Fruit
name::String
process::Function
end
apple = Fruit("Apple", () -> println("apple"))
orange = Fruit("Orange", () -> println("orange"))
another_orange = Fruit("My Other Orange", orange.process)
apple.process() # => "apple"
another_orange.process() # => "orange"
# or:
process(fruit) = fruit.process()
process(apple)
Inheritance/hierarchy could be achieved by having a parent
field in the struct.