I see that in bash the command

```
echo $(((i=18)))

```

prints 18.
This makes me understand that $(((i=18))) is interpreted as an arithmetic expansion (with the variable i being initialized inside the construct).
Though, one could also think of a command substitution

```
$(command)

```

with

```
((i=18))

```

being the `command`.
As a matter of fact, it looks command substitutions come **before** arithmetic expansions (*Learning the bash Shell*, O'Reilly 2005, p. 181).
Therefore the result is not what one should expect. How do you explain this?