3 ms·
I agree, it only works when you're not too dynamic. Smalltalk wasn't designed that way. You need a compiler that can tell when thing A requires thing B at a fi
by skybrian 11y ago
I agree, it only works when you're not too dynamic. Smalltalk wasn't designed that way.
You need a compiler that can tell when thing A requires thing B at a fine-grained level. That often requires type declarations, or at least fairly unique function names.
You also need library owners to design with tree-shaking in mind, so that calling library function A doesn't automatically pull in library function B. You need sane dependencies.
You also need dependency injection (if you have it) implemented in a way that doesn't defeat tree-shaking.
GWT, Closure, and Dart all do this by not being too dynamic (most of the time). In particular, reflection and tree-shaking don't work well together.