pub fn all_instances(engine: TrackedMut<'_, Engine<'_>>) -> EcoVec<NodeInstance>Expand description
Returns a list of all instances of nodes
Nodes without static parameters have a single “unit” instance, while nodes with at least one static parameter have as many instances as there are call sites with a different tuple of static arguments.
As of now, every single node instance will be (type-)checked individually.
§Discovery
As you might expect, discovering all instances can be a recursive process, not unlike resolving file imports, as a parametric node can instantiate other parametric nodes itself. This “recursion” is actually expressed as a flat loop, as not doing so easily causes stack overflows even with small depths.
§Future improvements
On recursive nodes with a constant value parameter, this recursive instanciation can consume a
lot of memory for nothing (for instance, a recursive power<<const EXP = 10>> will require 9-10
instanciations). If we ever move to an HL-based type checker, it might be possible to avoid
instanciation altogether by expressing relations with symbols. It would also be a very efficient
way to detect infinite recursion.