3 ms·
Why do you need a handwritten clif file?
by gumby 10y ago
Why do you need a handwritten clif file?
- gumby 10y agoWhy would this be down voted? It's a legit question, and a followup in the comment chain. I understand why SWIG needs a .i file, as it doesn't understand much about the code. But when you control the compiler you can 1> as in the example I gave, look at actual explicit instantiation instead of doing the synthetic thing SWIG does, as well as make other, smarter decisions and 2> use #pragmas or attributes to direct translation at the point of use. And the author even said himself that "code two files is a pain." Thus my question remains: why the need for a .clif file?
- mish33 10y agoA C++ header file is full of garbage^W implementation details and not-C++ users want a stable API definition - that's what .clif file is about. It's an interface declaration for a native user.
- mountain_lion 10y ago#pragmas are not portable, and have various problems with compatibility. Structured comments could work, but because the C++ compiler doesn't parse them, you essentially have a file-with-a-file, and 80% of the problems you encounter with the dual-file system. You also have the problem of the API's client trying to understand what the API looks like. We don't want to make them read C++ code in any way, and a pyclif file looks a lot like python. Finally, CLIF is substantially more terse than SWIG--on the order of 1/10th the number of lines. This makes it less of a big deal to have a separate file.