3 ms·
Why can't you just have the higher level representation of the code available and just recompile everything?
by byt143 7y ago
Why can't you just have the higher level representation of the code available and just recompile everything?
- slavapestov 7y agoBasically, because Swift has to support separate compilation of shared libraries. The @inlinable attribute is in fact implemented by serializing the high-level IR of a function as part of the module's interface; but doing this for all functions would be a non-starter, because it would place unacceptable restrictions on binary framework evolution. You can think of @inlinable as being somewhat similar to defining a function in a C header file. Unlike C++ templates, Swift generics don't require all definitions to be available at compile time, because dictionary passing is used to compile generic code when monomorphization cannot be performed.