Hacker News new | ask | show | jobs
by overgard 4384 days ago
That's true in a hand-wavey sense, but it ignores that function+struct means you have to define new types, include those types everywhere your closure is used, manage the lifetime and scope of those types, etc. etc.

I would argue the opposite: these things are actually way more useful than they seem at first. The fewer things the language makes you think about, the more you can focus on what you're trying to actually do.

1 comments

It's true literally.[1] If the language was designed around closures that's one thing. In C, it would be one language paradigm too many.

If you want a language with closures, and all you have is C, the time-honored solution is to write an interpreter and give the interpreted language closures. That is a good way to go.

[1] http://matt.might.net/articles/compiling-scheme-to-c/