22 ms·
Vala seems to be doing ok targeting C. I'd hardly say it's just for toys.
by MaxBarraclough 9y ago
Vala seems to be doing ok targeting C. I'd hardly say it's just for toys.
- humanrebar 9y agoHow does Vala handle debugging info and compiler diagnostics? Do the end users have to analyze the emitted C when something goes wrong?
- MaxBarraclough 9y agoAnnoyingly Vala is extremely shy about the generated C, but I believe it uses #pragmas to map the generated C back to the Vala source. I've only dabbled in Vala, but apparently its "-g" flag lets you debug with GDB. https://wiki.gnome.org/Projects/Vala/Tutorial#Debugging https://wiki.gnome.org/Projects/Vala/Tutorial#Debugging
- qznc 9y agoThere certainly is a grey area. For example, there are esoteric architectures which LLVM does not support but a C compiler exists. Emitting C is probably easier than developing a few LLVM backends. Still, my simple opinion is: If you are serious, use LLVM. It is not that much harder than outputting C and has clear advantages like debug information.
- MaxBarraclough 9y agoAs I mention below, Vala debugging isn't the catastrophe you think: https://wiki.gnome.org/Projects/Vala/Tutorial#Debugging https://wiki.gnome.org/Projects/Vala/Tutorial#Debugging I believe it's based on #pragmas that tell the C compiler (and/or GDB, presumably) which line of which file to blame. Serious work has been done in Vala. It's not fair to dismiss the language as a quaint toy.
- qznc 9y agoPreprocessor directives are not powerful enough [0], imho. [0] https://news.ycombinator.com/item?id=16197856 https://news.ycombinator.com/item?id=16197856
- MaxBarraclough 9y agoThat isn't an attribute of using C as an IR, it's an attribute of optimising compilers. The solution is to disable optimisation for debug builds, not to avoid C. From the gnome.org page: > The -g command line option tells the Vala compiler to include Vala source code line information in the compiled binary
- mirekrusin 9y agoNim does it as well, but in case of Vala it's a bit different case as it emits glib based code with GObject and friends - basically whole OO system with containers, event loop and what not. The idea of Vala is that if you're using glib then using Vala will generate glib code as if you'd write it by hand, but much easier. The rationale is much stronger to emit C as you can mix it with existing code etc.