This is the mail archive of the guile@cygnus.com mailing list for the guile project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
I think you're being a little inconsistent. Earlier, you wrote this: The point of this comment is completely lost on me. Your purpose when compiling a program is to produce binary code that has the same behaviour as you have described with your C code. You have no business trying to specify to the compiler exactly where you want each jump -- so long as the behaviour is guaranteed consistent. I read this to mean, "The compiler can do anything it wants, as long as the machine code has the same meaning as the source code, under the source language's semantics." A fine principle. Then you say: I feel that Hobbit's job is to translate nicely expressed scheme code into nicely expressed C code. If a tail call in scheme is optimisable to a jump then Hobbit should try to find an equivalent C tail call that is also optimisable to a jump -- because that is basically the nicest way to express the equivalent concept in the C language. Hobbit is a compiler, too, but you seem unwilling to give it the same freedom you give your C compiler: to do anything it pleases, as long as it preserves the semantics. You want it to produce C code that resembles your Scheme code. I think that the goal you've set for Hobbit would actually require Hobbit to be incorrect; here's why. The C standard is pretty loose about this, but it is widely agreed that a valid C implementation does not have to optimize tail calls. On the other hand, Scheme implementations are required to optimize tail calls. This, to me, suggests that a Scheme->C compiler is forbidden to translate Scheme tail calls into C tail calls. Given that C compilers are neither required nor expected to optimize tail calls, it would seem to me that Hobbit has not really remained true to Scheme's semantics. In general, I think it's best to give up on the idea of having readable output from your Scheme->C compiler; it's a big distraction from doing good compilation. (Let me say again: I think Hobbit is useful, and a good thing to have around. I'm concerned about the tail call issue, but I understand the choice Hobbit made.)