I have a good introductory example of the need for generated functions using multiplication of two objects of type `Vol{n}`

type representing an n-dimensional volume (see below for the code).

This could replace the part in the Julia manual that does things that don’t need generated functions, after which we are then told “Don’t copy these examples!” ! However, I am concerned that the level of the mathematical discussion (n-dimensional volumes) might just confuse the issue. The question is thus if it is suitable for the manual?

Of course, you can just give the code without the mathematical motivation, or replace the `+`

with a `*`

and treat it as a way to “put multiplication into the compile stage”.

```
immutable Vol{N}
volume::Float64
end
```

Instead of

```
import Base.*
*{N1,N2}(V1::Vol{N1}, V2::Vol{N2}) = Vol{N1+N2}(V1.volume * V2.volume)
* (generic function with 150 methods)
```

we should use

```
@generated *{N1,N2}(V1::Vol{N1}, V2::Vol{N2}) = :(Vol{$(N1+N2)}(V1.volume * V2.volume))
```

to get efficient code.