* [Caml-list] OCaml to C @ 2004-05-07 21:11 Jon Harrop 2004-05-08 21:37 ` John Goerzen 0 siblings, 1 reply; 6+ messages in thread From: Jon Harrop @ 2004-05-07 21:11 UTC (permalink / raw) To: caml-list I was just wondering if there was a compiler which could convert ocaml code into self-contained, efficient C code which could then be sold? By efficient, I mean performance comparable to that of native-code compiled ocaml. I am asking because I think that C code (even unreadable C) may currently be more commercially viable than ocaml code. Cheers, Jon. ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Caml-list] OCaml to C 2004-05-07 21:11 [Caml-list] OCaml to C Jon Harrop @ 2004-05-08 21:37 ` John Goerzen 2004-05-09 8:50 ` Jere Sanisalo 0 siblings, 1 reply; 6+ messages in thread From: John Goerzen @ 2004-05-08 21:37 UTC (permalink / raw) To: Jon Harrop; +Cc: caml-list On Fri, May 07, 2004 at 10:11:12PM +0100, Jon Harrop wrote: > I was just wondering if there was a compiler which could convert ocaml code > into self-contained, efficient C code which could then be sold? By efficient, > I mean performance comparable to that of native-code compiled ocaml. > > I am asking because I think that C code (even unreadable C) may currently be > more commercially viable than ocaml code. I believe there has been some work to develop C parsers or pretty printers for camlp4. I don't think that any of them can do exactly what you want yet -- making a completely self-contained program -- since, of course, there are pieces of the OCaml runtime to bring along. However, if you are going to do that, why not just compile the code to native code with ocamlopt and not worry about the C piece? -- John ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Caml-list] OCaml to C 2004-05-08 21:37 ` John Goerzen @ 2004-05-09 8:50 ` Jere Sanisalo 2004-05-09 19:48 ` David Brown 2004-05-10 19:10 ` John Goerzen 0 siblings, 2 replies; 6+ messages in thread From: Jere Sanisalo @ 2004-05-09 8:50 UTC (permalink / raw) To: caml-list On Sat, May 08, 2004 at 04:37:16PM -0500, John Goerzen wrote: >However, if you are going to do that, why not just compile the code to >native code with ocamlopt and not worry about the C piece? Because ocaml compilers/runtimes do not exist for every platform (say, consoles). And because compiling to C code could allow you to write independent libraries for others to use. It would be nice to release libraries that do a ton of stuff, usable for C/C++ coders, that were written easily with ocaml. And also some managers seem to trust projects that are "pure C/C++" much more than projects that use a variable amount of languages. -- Jere Sanisalo [xm@xmunkki.org] - http://www.xmunkki.org/ ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Caml-list] OCaml to C 2004-05-09 8:50 ` Jere Sanisalo @ 2004-05-09 19:48 ` David Brown 2004-05-10 19:10 ` John Goerzen 1 sibling, 0 replies; 6+ messages in thread From: David Brown @ 2004-05-09 19:48 UTC (permalink / raw) To: Jere Sanisalo; +Cc: caml-list On Sun, May 09, 2004 at 11:50:00AM +0300, Jere Sanisalo wrote: > Because ocaml compilers/runtimes do not exist for every platform (say, > consoles). And because compiling to C code could allow you to write > independent libraries for others to use. The runtime is actually there for a reason. It is much of what makes ocaml, ocaml. Even if you could generate C code from ocaml (it probably wouldn't be very good, unless you did lots of non-compiler-portable tricks like GHC), it would still need the same kind of runtime. Ocaml programs generate a lot of short-lived garbage. Without a garbage collector, the program would eat up a lot of memory. The native code runtime isn't very big. I think effort would be better spent porting the runtime to these new platforms. Dave Brown ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Caml-list] OCaml to C 2004-05-09 8:50 ` Jere Sanisalo 2004-05-09 19:48 ` David Brown @ 2004-05-10 19:10 ` John Goerzen 2004-05-10 20:03 ` Eric Stokes 1 sibling, 1 reply; 6+ messages in thread From: John Goerzen @ 2004-05-10 19:10 UTC (permalink / raw) To: Jere Sanisalo; +Cc: caml-list On Sun, May 09, 2004 at 11:50:00AM +0300, Jere Sanisalo wrote: > On Sat, May 08, 2004 at 04:37:16PM -0500, John Goerzen wrote: > >However, if you are going to do that, why not just compile the code to > >native code with ocamlopt and not worry about the C piece? > > Because ocaml compilers/runtimes do not exist for every platform (say, > consoles). And because compiling to C code could allow you to write > independent libraries for others to use. It would be nice to release > libraries that do a ton of stuff, usable for C/C++ coders, that were written > easily with ocaml. And also some managers seem to trust projects that are > "pure C/C++" much more than projects that use a variable amount of > languages. IMHO, a better approach than generating C output of questionable usefulness would be to extend ocamlopt to: 1. Support those platforms it doesn't yet; 2. Support output to .o/.a/.so/.dll files to directly generate C-style shared libraries. I still don't see the utility of the massive undertaking that would be necessary to actually generate full C code from OCaml. I doubt that anyone would be able to maintain that C code directly in any meaningful way, which pretty much negates any manager-related benefit. -- John ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Caml-list] OCaml to C 2004-05-10 19:10 ` John Goerzen @ 2004-05-10 20:03 ` Eric Stokes 0 siblings, 0 replies; 6+ messages in thread From: Eric Stokes @ 2004-05-10 20:03 UTC (permalink / raw) To: John Goerzen; +Cc: caml-list, Jere Sanisalo On May 10, 2004, at 12:10 PM, John Goerzen wrote: > On Sun, May 09, 2004 at 11:50:00AM +0300, Jere Sanisalo wrote: >> On Sat, May 08, 2004 at 04:37:16PM -0500, John Goerzen wrote: >>> However, if you are going to do that, why not just compile the code >>> to >>> native code with ocamlopt and not worry about the C piece? >> >> Because ocaml compilers/runtimes do not exist for every platform (say, >> consoles). And because compiling to C code could allow you to write >> independent libraries for others to use. It would be nice to release >> libraries that do a ton of stuff, usable for C/C++ coders, that were >> written >> easily with ocaml. And also some managers seem to trust projects that >> are >> "pure C/C++" much more than projects that use a variable amount of >> languages. > > IMHO, a better approach than generating C output of questionable > usefulness would be to extend ocamlopt to: > > 1. Support those platforms it doesn't yet; > 2. Support output to .o/.a/.so/.dll files to directly generate I would personally very much like to see ocamlopt able to generate shared libraries, both for use directly with Ocaml (eg .cmxso), and for linking with C programs. > C-style shared libraries. > > I still don't see the utility of the massive undertaking that would be > necessary to actually generate full C code from OCaml. I doubt that > anyone would be able to maintain that C code directly in any meaningful > way, which pretty much negates any manager-related benefit. > > -- John > > ------------------- > To unsubscribe, mail caml-list-request@inria.fr Archives: > http://caml.inria.fr > Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: > http://caml.inria.fr/FAQ/ > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2004-05-10 20:03 UTC | newest] Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2004-05-07 21:11 [Caml-list] OCaml to C Jon Harrop 2004-05-08 21:37 ` John Goerzen 2004-05-09 8:50 ` Jere Sanisalo 2004-05-09 19:48 ` David Brown 2004-05-10 19:10 ` John Goerzen 2004-05-10 20:03 ` Eric Stokes
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox