Ooc – a small programming language that compiles to C99
ooc-lang.org
ooc-lang.org
Is the idea that you can compile you base code once, and then work on the emitted C to extend the project?
Another theoretical advantage of generating C code is that it should be easy to try adding bits of code written in these new languages to existing C/C++ projects. In this way you can test the new language on real life projects without the need of rewriting everything from scratch. (I have never followed this approach, although I have heard of people having done this [1].)
[1] http://roscidus.com/blog/blog/2014/06/06/python-to-ocaml-ret... The languages here were quite different, though (Python/OCaml): but the author followed the idea of slowly converting a project to a new language by first rewriting parts of it. Had the OCaml compiler emitted Python code, I bet the task would have been easier.
EDIT: oh, also wildly easy interoperability with existing C/C++ code (so long as the C++ code provides a C interface).
Nim is one language that I know of which takes advantage of that. Here is one example of a pretty large wrapper around a C++ library https://github.com/3dicc/Urhonimo, and here is the documentation for this feature http://nim-lang.org/docs/manual.html#implementation-specific...
I've even occasionally managed to get code from compiled-to-C languages working on platforms like RiscOS and Amiga.
Languages that can be compiled to C could be interesting for implementing embedded system firmware.
You don't have to deal with all the idiosyncrasies of C, because you can restrict yourself to a small subset of C that is straightforward and easily understood.
A certain subset of C++ seems to solve a lot of peoples' problems with C, but it also seems there's no consensus on what that subset is. So people stick with C because at least the rules are defined. Compile-to-C languages like this could have all the benefit of switching to C++ without the downsides
I've tried everything else that's popular in the domain at this point and overwhelmingly, the problem is that new systems languages are too big, too incompatible with the existing ecosystem, or too immature in their tooling. They are usable, and many of their cares and concerns are justifiable, but they're overwhelming in a lot of ways. The compilers do so much, and they break, they have weird error messages, or do surprising things with their advanced features. They're mainly built by people who want to make great compiler technology - and they have that, but that doesn't necessarily lead to a smooth development experience on my end.
Most of those issues are sidestepped with a smaller language that just encodes a bunch of common idioms, which OOC does. There are other viable "compile to C" languages out there, of course, but I'm getting more interested in this one.
Edit: And yeah, this is the Go argument. But Go doesn't want to be C-like, really.
Among languages I've enjoyed using and achieving high productivity is CHICKEN Scheme[1]. The compiler defaults to emitting C, though usually the C code is immediately compiled into binary object or executable form. CHICKEN also integrates very well with C as embedded in a C application, using C libraries or writing C directly in "foreign-lambda*" expressions.
[0] http://stackoverflow.com/questions/6498850/programming-langu... [1] http://call-cc.org
[1] https://en.wikipedia.org/wiki/Cfront [2] http://chapel.cray.com/ [3] http://nim-lang.org/
[1]: http://nim-lang.org
The code snippet seemed uninteresting and to lack anything original, the pitch wasn't really selling much, and to top it off there were some text blurbs that seemed unfinished.
Then I saw your comment and read the tutorial. This was actually a pretty interesting read, even without actually following along in a console.
I find it assumes a bit too much so I don't think a total beginner would like it, but for someone used to toying around with new languages it's very well presented I think.
I think these sort of tools are interesting because many companies are stuck with some ancient language hurting productivity, but being able to use tools like this one can circumvent some of the problems, if only for new code as existing code will have to be maintained in C.
Commiting generated code, are you crazy? I don't care how pretty it looks, if it's not source code, it doesn't belong to source control.
If you still want to put generated C dode in the repository, you can, but the second you type `push` command is the second your C code becomes source code. Treat it as such.
Or, just put Ooc code into the repository. That is the source code after all.