6 ms·
What systems are those? And why do you need "human readable C"? You said you needed it to work in a natively compiled shared library environment. You do not
by MustardTiger 10y ago
What systems are those? And why do you need "human readable C"? You said you needed it to work in a natively compiled shared library environment. You do not need to compile to C for that. But if you really want to do that for some reason, you can do it.
- jjnoakes 10y agoI'd prefer it to be human readable because it helps in debugability if the code generator is broken (or we misunderstand some subtle semantics and want to look closer), and if I ever want to move away from the language in the future. Ignoring that, if I don't compile to C or C++, then I'm not sure how easy it will be to use. Are you suggesting Haskell can generate object files, shared objects, and binaries for my systems without compiling to C or C++ first? How would it get the file formats and calling conventions right? Can I specify them somehow to Haskell (doubtful)?
- MustardTiger 10y ago>Are you suggesting Haskell can generate object files, shared objects, and binaries for my systems without compiling to C or C++ first? Of course, that's what ghc does by default. >How would it get the file formats and calling conventions right? The same way every other compiler does. What systems are we talking about?
- jjnoakes 10y ago> Of course, that's what ghc does by default. ghc by default can generate object files for systems it doesn't know about? That sounds positively magical. How does it work? > The same way every other compiler does. Every other compiler that targets native code for these systems has first-hand knowledge of the file formats. If Haskell doesn't require that knowledge, I would love to hear about how it works. Here's an example. Say Haskell only supported Windows on x86_64 and I'd like to build my Haskell program for Linux on PowerPC. Are you telling me Haskell on Windows could generate Linux on PowerPC executables and shared libraries without first-hand knowledge of the instruction set, calling conventions, and the ELF file format?
- MustardTiger 10y agoI don't know why you are being so hostile and evasive at the same time. What systems are you talking about. I will tell you if there is a compiler that supports them. That's the problem right? That it will turn out that your obscure systems are very normal and supported. Silly fallacious replies about magic are not constructive. Just answer the question and I can help you.
- jjnoakes 10y agoI'm not being hostile at all. If such a thing exists as I believe you described it, I would find it to be magical and would love to use it. I would even pay for it. And I'm not being particularly evasive either. I gave you an example which fits my situation perfectly. I'd prefer not to reveal the names of the actual systems I need to build for, since it would fairly uniquely identify me. Are you willing to work with the hypothetical I put forward? Or are you dodging that in favor of attacks on me personally?
- MustardTiger 10y agoEvery native compiler does this. There is nothing magical about it. Obviously the platform has to be supported. That's why i asked what the platform is. The idea that you are the only person running a system is absurd. Even the most obscure platforms have thousands of active users. Your hypothetical can not be worked with, because it is a concrete question. Is your platform supported or not. Very simple. And again, if you want to have it generate C, then do so.
- jjnoakes 10y agoYou think I haven't tried using Haskell on my platform? It isn't supported and it doesn't work. So you misrepresented things. I mean why would my first post be "Boy I wish I could use Haskell on my platform" if... I could use Haskell on my platform? Now I could put a ton of effort into it... for each platform... but I don't have that kind of time to maintain Haskell for N platforms. It would be much easier to compile via portable C or C++ that was human readable. But I would expect, since Haskell has lazy evaluation and a GC, that there is almost no way to map to readable C or C++. Thunks flying around, continuations, ...