From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by walapai.inria.fr (8.13.6/8.13.6) with ESMTP id pB9NIU9X031056 for ; Sat, 10 Dec 2011 00:18:34 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AjUBAI+W4k7ZSMDdi2dsb2JhbABDqnsiAQEBCgsLBxIFIoFyAQEEAScTPwULCxIGCSUPAQQoDR4JiAcCtVqIWIMaBJonjHE X-IronPort-AV: E=Sophos;i="4.71,329,1320620400"; d="scan'208";a="134785601" Received: from fmmailgate01.web.de ([217.72.192.221]) by mail1-smtp-roc.national.inria.fr with ESMTP; 10 Dec 2011 00:18:33 +0100 Received: from moweb002.kundenserver.de (moweb002.kundenserver.de [172.19.20.108]) by fmmailgate01.web.de (Postfix) with ESMTP id 126BB1A43D129 for ; Sat, 10 Dec 2011 00:18:33 +0100 (CET) Received: from frosties.localnet ([95.208.118.96]) by smtp.web.de (mrweb002) with ESMTPA (Nemesis) id 0MGzFy-1RUDm60LSM-00DquJ; Sat, 10 Dec 2011 00:18:32 +0100 Received: from mrvn by frosties.localnet with local (Exim 4.77) (envelope-from ) id 1RZ9hx-0008RI-9A; Sat, 10 Dec 2011 00:18:25 +0100 From: Goswin von Brederlow To: oleg@okmij.org Cc: caml-list@inria.fr, ontologiae@gmail.com References: <20111209065758.94306.qmail@eeoth.pair.com> Date: Sat, 10 Dec 2011 00:18:25 +0100 In-Reply-To: <20111209065758.94306.qmail@eeoth.pair.com> (oleg@okmij.org's message of "9 Dec 2011 06:57:58 -0000") Message-ID: <87aa712v26.fsf@frosties.localnet> User-Agent: Gnus/5.110009 (No Gnus v0.9) XEmacs/21.4.22 (linux, no MULE) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Provags-ID: V02:K0:Y3FXSKQs6emC/aJNVWekXKPqrGZnB/gCwLCAaTCBIxY uzjtpHeXGBz+v9c0CCa0ftD1o5EblQvO1b6SOdJMtYWXv5gpbA SmTf5gaApXVwxufSoUN1ELPuEOp8RkZqflmlLDqeBhGRoBsTg0 01kq59eTSJBq+FlLDpVuDQLmbXgcouyNHE8G2s76UyZUZqMfeH 701Zcrb6UkPnBdC10SooQ== Subject: Re: [Caml-list] Why NOT to compile OCaml via C oleg@okmij.org writes: > Pierre-Alexandre Voye wrote: > >> Note that if Ocaml compiler would have a C backend, all these problems or >> architecture port would disappear... >> Ocaml would have more than 30 target[1] >> In my Opinion, trying to generate assembler is a bad idea because modern CPU >> require a lot of work to generate good assembler. > > There are many good reasons to avoid C when compiling functional > languages, especially strict ones. > > One often hears that ``C is a portable assembler''. That has never > been true. One of the reasons is that every assembler I know has the > "jmp" instruction, which, without affecting SP, transfers control > anywhere, out of a procedure or in the middle of a procedure, out of a > module or into a module. C is built around the stack discipline -- > after all, C is a descendant of Algol 60. (Although C has labels, they > are limited, even in GCC). Although Algol-60 researchers quickly > recognized the value of tail recursion, all that knowledge was lost in > the Dark Ages. Well, write the code as ONE function and do use lables. Sure, the C source will be huge for larger projects but then again you get the single source optimization bonus from gcc. Note: gcc does know something about tail recusion. So it is not completly lost there. Personly I would like to have a ocaml -> C compiler. Not to replace the one we have but for fun or as alternative on architectures that don't have a native compiler (yet). It doesn't have to be hype efficient. If it is somwhere between the bytecode and native speed that would be totally fine. MfG Goswin