Live data from Hacker News

Real World OCaml

realworldocaml.org

81–83 of 83 posts

Re: Real World OCaml

#81
post #74
post #33

For the early adopters and experimenters amongst you, you might like Felix http://felix-lang.org/share/src/web/tutorial.fdoc It is a whole program optimized, strongly typed, polymorphic, ML like language that can interact effortlessly with C and C++ code and has coroutines baked in. Its own demo webserver is based on coroutines. It uses a mix of lazy and eager evaluation for performance and compiles down to C++. Exec…

> compiles down to C++. Execution speed is comparable to C++, mostly better. Uh, what. Can you clarify?

This seems counter-intuitive to people who don't write compilers, but a language that compiles to C++ can perform "better than C++" because it can emit code that no human would bother writing, usually taking advantage of information available in the source language that couldn't be safely determined by the C++ compiler alone. Whole program optimization, for example, allows you to do a lot of aggressive reorganization of code that would be very ugly if done by hand (think of putting all your code in one file and putting everything in an anonymous namespace).

Re: Real World OCaml

#82
post #74

Earlier quoted context omitted.

> compiles down to C++. Execution speed is comparable to C++, mostly better. Uh, what. Can you clarify?

This seems counter-intuitive to people who don't write compilers, but a language that compiles to C++ can perform "better than C++" because it can emit code that no human would bother writing, usually taking advantage of information available in the source language that couldn't be safely determined by the C++ compiler alone. Whole program optimization, for example, allows you to do a lot of aggressive reorganization…

Then say "better than hand-written C++", not "better than C++". It's like saying "C++ performs better than assembly". No it doesn't. It may perform better than hand-written assembly, and that's completely different.

It's just annoying when people will do anything to get on the "faster than C++" wagon.

Re: Real World OCaml

#83
post #77

Earlier quoted context omitted.

Rust was originally implemented in OCaml, though. You're correct theyre not exactly in the same category, but there is influence there.

OCaml is a popular tool for implementing languages, IIRC the javascript referecence standard was implemented in ocaml as well.

Whops, no, that was actually Standard ML:

http://lambda-the-ultimate.org/node/1784

Post reply on HN