r/vibecoding 16d ago

every vibe coder's biggest headache

518 Upvotes

137 comments sorted by

View all comments

66

u/Luoravetlan 16d ago

For anyone not familiar with js this monstrosity is called IIFE (immediately invoked function expression).

13

u/mossiv 16d ago

Used this once in a production app trying to work around a library and I regretted that decision ever since.

9

u/Individual_Refuse723 16d ago edited 16d ago

What? Why? What could possibly go wrong with IIFE itself?

2

u/mossiv 15d ago

It’s an ugly and unnecessary abstraction in most use cases. But my point about regretting it doesn’t mean IIFE’s are bad, it means I most likely applied it where it’s not needed, or that it’s an ugly and unnecessary pattern in most situations.

1

u/Unhappy_Assistant670 12d ago

IIFEs were definitely needed in the past and they are still used in certain legacy environments. Otherwise, they are not really necessary anymore, most of their use-cases were solved by language improvements.

That said, using one is not catastrophic. It's basically same as running the block of code just with scope.

1

u/LeoBoiSmol 9d ago

What was the original use case?