3 ms·
"But C++ often hits a sweet-spot between languages where high-level abstractions are available with the raw power of C when you need it." He then goes on to say
by swolchok 17y ago
"But C++ often hits a sweet-spot between languages where high-level abstractions are available with the raw power of C when you need it." He then goes on to say he uses Ruby and not Python. Is Ruby missing nice C integration? Python is oft-touted as the sweet spot here, although I have to confess I haven't done a whole lot of Python/C or Python/C++ integration.
- noamsml 17y agoMost languages with C integration can be integrated into C++ quite reasonably, if not optimally.
- stcredzero 17y agoIn Smalltalk/X, you can just inline C in a method. There are ways of doing that for Ruby as well. It's also fairly easy in Smalltalk generally to do callouts to a DLL, or to implement your own "primitive" method in C.
- wheels 17y agoI just like Ruby more. You can connect both Python and Ruby to C APIs, and I've done so in the past from Ruby. C++ integration is usually moderately more annoying since once you start moving beyond ordinal types cross-language communication becomes hairier. C ends up being the lingua franca between programming environments a lot of the time.
- kingkongrevenge 17y agoIt is just as easy to extend any of the scripting languages with C++ as it is with C. SWIG and other systems like XS have built-in support for C++. Even if that weren't true, you can just make your interface header files 'extern "C"' yet enjoy the superior power of C++ in your implementation files. There is no reason to favor C over C++ when extending a scripting language.
- wheels 17y agoRight. By "I extended them with C", I meant, "I extended them with a C interface"; the implementation was in C++.
- stonemetal 17y agoI think he meant that if you were going to pick one language that was both high level and perform well it would be C++. To do better you would have to, as you suggest, split it in to two languages.
- davidw 17y agoTcl is actually the sweet spot in terms of its C API - you can do pretty much anything you can do in the language itself, and more. And it's all very nice code to work with.
- kingkongrevenge 17y agoI've rewritten Python programs in C++ and got close to the same line count, yet hugely better resource usage. You can't do that with C. With C++ you often don't need to reach for a heavy and slow language. You'll do just as well for maybe a 2X development speed penalty.