The Wasm spec defines 3 kinds of element segments: passive, active, and declarative.
Passive element segments can be used to set the values of a Table at runtime, and Active element segments automatically set the values of a Table during module instantiation.
However, I don't understand what purpose declarative element segments serve. The spec says:
A declarative element segment is not available at runtime but merely serves to forward-declare references that are formed in code with instructions like ref.func.
Ok, but what purpose does that serve? Why would I want or need to forward-declare references in an element segment?
The only other places I've found that this might influence are in module instantiation. However, there the only thing that seems to be done with declarative element segments is that they are immediately dropped in step 15 of module instantiation. They do appear in module instantiation Step 9 as well, however while briefly skimming that definition of (ref*)* seems to only be used to define elementaddr*, so as far as I can tell, this just means that declarative elements are included in element indexing/addressing but aren't used anywhere else.
Am I missing something? Are declarative elements used in validation somehow? Or are they intended for possible future expansion and don't do anything in the current version of the WebAssembly specification?
This question is based on WebAssembly Specification Release 2.0 (Draft 2024-04-28)