# \#recursion

**URL:** https://forums.swift.org/tag/recursion/196.md

[Latest](https://forums.swift.org/latest.md) · [Categories](https://forums.swift.org/categories.md) · [Tags](https://forums.swift.org/tags.md)

---

## [Unorthodox recursive data structures](https://forums.swift.org/t/unorthodox-recursive-data-structures/89885)

<div class="topic-metadata">

**Author:** [@tera](https://forums.swift.org/u/tera)\
**Replies:** 2\
**Last updated:** [October 4, 2026, 10:28am UTC](https://forums.swift.org/t/unorthodox-recursive-data-structures/89885 "2026-10-04T10:28:48Z")

</div>

The topic name is a bit misleading as what's discussed here: could be mutable could be truly allocation free, could be stack allocated or in some cases uses heap allocation behind the curtains. could be truly dynamic (…

---

## [Any insight about this compiler crash? Workarounds?](https://forums.swift.org/t/any-insight-about-this-compiler-crash-workarounds/82303)

<div class="topic-metadata">

**Author:** [@jeremyabannister](https://forums.swift.org/u/jeremyabannister)\
**Replies:** 3\
**Last updated:** [September 23, 2025, 12:06pm UTC](https://forums.swift.org/t/any-insight-about-this-compiler-crash-workarounds/82303 "2025-09-23T12:06:44Z")

</div>

I filed an issue for this crash, but I also want to post it here because for these types of things I often get some interesting insights into what’s really going wrong and/or workarounds when I post them to the forums (u…

---

## [Why can't this class have a related-recursive stored property?](https://forums.swift.org/t/why-cant-this-class-have-a-related-recursive-stored-property/72491)

<div class="topic-metadata">

**Author:** [@CTMacUser](https://forums.swift.org/u/CTMacUser)\
**Replies:** 3\
**Last updated:** [June 17, 2024, 8:21pm UTC](https://forums.swift.org/t/why-cant-this-class-have-a-related-recursive-stored-property/72491 "2024-06-17T20:21:06Z")

</div>

final class MyType\<T: Comparable, each U: Comparable, V: Comparable\> { typealias Data = (T, repeat each U, V) typealias NextNode = MyType\<repeat each U, V, T\> //... } On the third line, the occurrence of "MyType"…

---

## [Alternate ways to create combinations of a range of numbers](https://forums.swift.org/t/alternate-ways-to-create-combinations-of-a-range-of-numbers/56722)

<div class="topic-metadata">

**Author:** [@brontus](https://forums.swift.org/u/brontus)\
**Replies:** 7\
**Last updated:** [April 14, 2022, 1:11am UTC](https://forums.swift.org/t/alternate-ways-to-create-combinations-of-a-range-of-numbers/56722 "2022-04-14T01:11:33Z")

</div>

Hello Swift crew! This is my first post. I'm on a self-learning journey with Swift. I'm working my way through Stanford's latest iOS course that's available publicly. As an exercise, I'm going to complete an assignment…

---

## [Generic function specialization for recursive protocols trying to chose wrong function](https://forums.swift.org/t/generic-function-specialization-for-recursive-protocols-trying-to-chose-wrong-function/38559)

<div class="topic-metadata">

**Author:** [@umurgdk](https://forums.swift.org/u/umurgdk)\
**Replies:** 5\
**Last updated:** [July 19, 2020, 4:00pm UTC](https://forums.swift.org/t/generic-function-specialization-for-recursive-protocols-trying-to-chose-wrong-function/38559 "2020-07-19T16:00:16Z")

</div>

I'm trying to build a view builder abstraction to match types of view builders and nested data structures (or tree like structures where each level of tree can have different type of value). I've defined two protocols fo…

---

## [How is defer timed with recursive calls?](https://forums.swift.org/t/how-is-defer-timed-with-recursive-calls/20552)

<div class="topic-metadata">

**Author:** [@CTMacUser](https://forums.swift.org/u/CTMacUser)\
**Replies:** 1\
**Last updated:** [February 16, 2019, 2:00am UTC](https://forums.swift.org/t/how-is-defer-timed-with-recursive-calls/20552 "2019-02-16T02:00:45Z")

</div>

My code for a loop-less sequence-on-filter-sequence method required me to add a do-block to prevent infinite recursion. It seems that if a return path involves a (tail?) recursive call, then outstanding defer blocks don…

---

## [How to create a recursive closure?](https://forums.swift.org/t/how-to-create-a-recursive-closure/19189)

<div class="topic-metadata">

**Author:** [@kelin](https://forums.swift.org/u/kelin)\
**Replies:** 4\
**Last updated:** [January 1, 2019, 8:16pm UTC](https://forums.swift.org/t/how-to-create-a-recursive-closure/19189 "2019-01-01T20:16:51Z")

</div>

It seems like it's impossible without intermediate functions. (Sorry, didn't found a similar question)
