Yes, blocks are going to replace IEFEs, as soon as block-scoped declarations (functions, let
/const
/class
) become widely adopted. You need a scope, e.g. for a closure? Here you have a block, be it a loop body or just part of a statement list.
However, there is still one application of IEFEs that blocks cannot replace: the module pattern. Blocks don't have return values, and mutating higher-scoped variables is ugly, so we will still see function expressions in the creation of objects that need private state:
const example = (() => {
…
return …;
}());
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…