Hacker News new | past | comments | ask | show | jobs | submit login

Can you comment on why this is C and not C++? (Although some examples are in C++)



If you are writing this as a library you're most likely going to end up having to write a C wrapper for most language bindings. In the end it may just be easier to write the whole library in C and then write the specific binding for Python, Ruby, etc.


It's very easy to re-use C code in most other languages.


Sure, but why not write in C++ and just expose a C interface?


That's possible, but it doesn't actually save all that much effort, and the interface layer would slow things down needlessly.

The parts of C++ that I most missed with this project were standard libraries for string and vector. Many times they were just accumulating or munging values that would eventually end up in the C-API parse tree, and so if I wrote them in C++, I'd just need to translate to a C implementation afterwards. I could potentially have used classes & objects for some of the states, but the array-of-function-pointers that it currently uses is basically just as easy and simpler.





Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: