Software Unscripted cover image

Defunctionalization in a Functional Language with Ayaz Hafiz

Software Unscripted

CHAPTER

The Morific System for Closing Closures

In most languages, when you're closing over something or capturing it in a closure, you need some place to store the information of like what was captured. Now in a lot of languages, because that value can be sort of dynamic depending on the application that you're doing, this is an expensive problem. William Brandon pointed out that there's a system that you can use called de-functionalization for getting rid of these heap allocations and just pass your functions around. Because we're a monomorphizing compiler, we can make it so that however many different times you call the same function passing closures of different sized captures to it, we just generate a specialization for each of those functions that accepts that

00:00
Transcript
Play full episode

Remember Everything You Learn from Podcasts

Save insights instantly, chat with episodes, and build lasting knowledge - all powered by AI.
App store bannerPlay store banner