4 ms·
This looks awesome! The main thing holding me back from switching from C++ to C is the lack of type safe generic programming. This language looks like it not on
by _gabe_ 4y ago
This looks awesome! The main thing holding me back from switching from C++ to C is the lack of type safe generic programming. This language looks like it not only solves that, but adds some other interesting features like defer that I've been wanting to try out :D. It looks like there are some examples of large projects getting successfully compiled by C3 (the vkDoom).
Since this is still only alpha 0.2, I'm curious how stable the compiler is and whether the core language features are subject to change? I'd love to start using this on some projects, but I'm always afraid to adopt a language in its early stages.
- lerno 4y agoYou shouldn't use C3 on any larger project, but it could be an option for doing gamejams (with raylib or something else with a C API). For vkDoom it's not a port to C3. What it demonstrates is instead C <=> C3 interop. I removed some of the central functions from the C code and implemented those in C3. The script compiles the C files into .o files with the normal C compiler, then uses the C3 compiler to compile the .c3 files into .o files. Finally all are linked together into a single binary showing off the simple ABI compatibility story (no extra annotations are needed to ensure compatibility - all C3 functions are automatically callable as C functions) In regards to the versioning, I've gone through two versioning schemes for the pre-alpha. 0.1.0 is the first version I felt was sufficiently feature complete. Minor version changes (e.g. 0.1.x -> 0.2.x) is for any breaking changes. Minor version doesn't say how close it is to version 1.0 (minor version will continue after 0.9.x with 0.10.x). The 0.1 version was out in April. I try to make the compiler as solid as possible, but I would need thousands (rather than somewhere above 400) tests before I feel confident in the compiler. Releasing 0.1 means I think that the language design is mostly there now, so fewer changes are coming. But joining any language before 1.0 is a bumpy ride. Did that answer your question?
- chromatin 4y agoDlang's betterC mode [1] may be what you're looking for; D also has outstanding typesafe template-based metaprogramming. [1] https://dlang.org/spec/betterc.html https://dlang.org/spec/betterc.html
- JonChesterfield 4y agoattribute ((overloadable)) in C will name mangle and dispatch using a close approximation to the C++ rules. Much saner in use than _Generic.