3 ms·
It's like C++ template specialisation, but it happens when the compiler realises you need a particular version. Which may be at runtime, if you changed somethin
by JulianMorrison 6y ago
It's like C++ template specialisation, but it happens when the compiler realises you need a particular version. Which may be at runtime, if you changed something.
- dan-robertson 6y agoExcept the language can choose from suitable templates (eg instead of a generic matrix multiply template for floats, it can use a library like LAPACK) and does so in a systematic way. It also has a feature (I can’t recall the name) which is a bit like fexprs (let’s say macros who’s inputs are the types of the arguments of a function) that can generate customised code (eg an FFT depending on the input size) on the fly.
- gugagore 6y agoI believe you're thinking of https://docs.julialang.org/en/v1/manual/metaprogramming/#Generated-functions https://docs.julialang.org/en/v1/manual/metaprogramming/#Gen... (but I don't find it helpful to compare to fexprs, which I think of as more about deferring evaluation, whereas generated functions are about "staged programming".)