Hello everyone,

My question is related to dynamic dispatch. I will formulate it precisely at the end of my post.

I have searched the forum and the docs, but I could not find the answer. I apologize in advance if this topic duplicates an existing one.

I have the following code:

```
struct A1 end
struct A2 end
struct B1 end
struct B2 end
myfunction(prop1::A1 , prop2 :: B1) = 1.0
myfunction(prop1::A1 , prop2 :: B2) = 2.0
myfunction(prop1::A2 , prop2 :: B1) = 3.0
myfunction(prop1::A2 , prop2 :: B2) = 4.0
```

In my real calculation, the methods myfunction perform more complicated computations and call other functions that dispatch on the structs A1(), A2(), B1() and B2().

I want to iterate over the singleton structs to get the final result:

```
function mycalculation()
result =0.0;
for i in [A1() A2()]
for j in [B1() B2()]
result+= myfunction(i,j)
end
end
return result
end
```

I have 3 questions:

- Does the code above generate dynamic dispatch or is it problematic for a different reason?
- I donâ€™t really understand what dynamic dispatch is. I have searched the documentation, but I could not find the relevant section. How can I predict when it will happen?
- If the code above generates dynamic dispatch, how could I avoid it?

Many thanks in advance,

Olivier