4 ms·
C with a decent dynamic language (C + Lua for example) make a better choice, than C++. Or Objective C, or C+Python, C+Perl, C+WhateverElseDynamic.
by malkia 17y ago
C with a decent dynamic language (C + Lua for example) make a better choice, than C++. Or Objective C, or C+Python, C+Perl, C+WhateverElseDynamic.
- blasdel 17y agoA few of those work well starting from C, like: C + Lua or Objective-C For most of the rest it's possible to start in C and link in the language runtime, it's much easier to start in the runtime and extend it with C modules. From experience this is especially true for Python: I've used both ctypes and SWIG to turn the guts of existing native programs into Python libraries. I'm sure it's probably the case for Ruby and Perl as well. You could also just use Go by itself :)
- nfnaaron 17y agoWhy?
- silentbicycle 17y agoYou can write the stuff that needs to access system calls, deal with hardware, heavy number crunching, etc. in C, but use a language with garbage collection, real strings, and a REPL for all the stuff that doesn't need to be chiseled out of diamond (and will probably change, anyway). For many things, slow prototypes are good enough. When you could do 95% of a project quickly in Python/Lua/Ruby/etc., writing everything in C anyway has the same downsides as any other form of premature optimization. As a bonus, the border between the two languages often settles along conceptual seams in the codebase -- your low-level graphics rendering code shouldn't be tangled up with your enemy AI or UI templates, for example. Rather than writing everything in a language that tries to do everything and winds a mess (C++), you can use two smaller, more focused languages.
- nfnaaron 17y agoAh, my mistake. I thought you were contrasting C+Lua with all the other C+language pairs, C+Lua with C+C++.
- silentbicycle 17y agoThe comment was by someone else, but I think he/she meant C paired with any dynamic language vs. C++ alone, not C with Lua specifically.
- viraptor 17y agoThere's also a place for some C with sugar languages - OOC, Vala, etc.
- kingkongreveng_ 17y agoC++ with a decent dynamic language beats the crap out of C with a decent dynamic language. Chaiscript is a great project. You would take your C+Python app and rewrite the C bits in C++ and find it shorter and clearer and the same speed.