This is a simplified stack implementation optimized to reuse the nodes it creates.
Fluid uses stacks to iterate through tree structures such as Rope or TextRulerCache. The ability to quickly
create new stack items is crucial to their performance, and as such avoiding allocations is a must. For this reason,
nodes are reused whenever possible, instead of being reclaimed by the GC.
This is a simplified stack implementation optimized to reuse the nodes it creates.
Fluid uses stacks to iterate through tree structures such as Rope or TextRulerCache. The ability to quickly create new stack items is crucial to their performance, and as such avoiding allocations is a must. For this reason, nodes are reused whenever possible, instead of being reclaimed by the GC.