[ocaml-biz] what slow OCaml is worth

Brian Hurt bhurt
Mon Aug 30 01:26:00 PDT 2004


On Sun, 29 Aug 2004, Brandon J. Van Every wrote:

> Brian Hurt wrote:
> > Brandon J. Van Every wrote:
> > >
> > > - is baroque and difficult to learn compared to Python
> >
> > Only if you're comming from imperitive/OO languages.
> 
> Yes, and 'everyone' in the mainstream is, so the point stands.

I may be exceptional, but I was reading Ocaml code before I knew Ocaml.  
There was a data structure paper I was reading (I forget which one), which 
implemented the algorithm in what I thought was an interesting and 
intuitive pseudo-code.  Only after I learned Ocaml and went back to 
implement said data structure in Ocaml did I realize that it wasn't 
pseudo-code.

What the hey- I'm tired of pussy-footing around the issue.  I think the
biggest problem Ocaml has is how it's introduced.  You throw terms like
"lambda calculus", "higher order functions", "partial function
application", etc.  around up front, and except for a few whakos like
yours truely, you're going to scare everyone off.  The one dead-tree book 
I have on Ocaml uses all three terms in section one of chapter one- and 
even I considered running to the hills screaming.

My theory is that the right introductory book hasn't been written yet.  
Larry Wall may have created Perl, but Randall Schwartz made it popular.  
Said book should leverage the programming knowledge people already have-
but it should focus on the pragmatic.  Terms and concepts shouldn't be
introduced until they can be demonstrated, and demonstrated to be usefull.  
And it should be chock full of examples.  Working code to inspect, to the
extent possible solving real problems.  Stuff the reader might look at and
say "yeah- I could see myself implementing that".  And the book should 
take care to explain concepts which aren't common place in most popular 
languages- a classic example is recursion as looping.  Which I happened to 
already know before stumbling onto Ocaml, but a lot of people don't.

I'm taking a swing at writting this book.  I don't have anything I'm ready 
to show off yet, which is why I haven't been making any grand 
announcements.  I just wanted to say that I am, in fact, actually trying 
to do something towards making Ocaml more popular.

> 
> > - Choice of how to execute the resultant code- interpreted, virtual
> > machine, and compiled to native.  All of these have advantages and
> > disadvantages, even ignoring performance.  For example, I can
> > distribute a
> > native application to customers and they don't need Ocaml
> > installed to run it.
> 
> Yes, "you have a choice" is an important sales point.
> 
> > I don't see Python having a serious edge over Java in the language
> > department.  What big thing can Python do that Java can't?
> 
> Python is dynamically typed, interpreted, and not as verbose as Java.
> The learning curve is rather low, people master it readily.  Hence why
> our marketing phrase was "simple, elegant, powerful."
> 

Interpreted is a benefit for scripting languages.  It's not that usefull
for doing application work.

Note that Java is also effectively dynamically typed.  My experience in
Java has shown me where the anti-static-typing crowd gets their opinions-
if I didn't also have experience with Ocaml, I might even be one of them.
You can't express the type string list in Java without resorting to the
run time type checking via typecasting to Ocaml.  The unnecessary type
coercions are the main verbosity advantages Python has over Java.

>From what I can tell, in terms of core concepts and ideas, Python is
closer to Java than Java is to C++.  And how many people say that Java is
just a cleaned up and simplified C++?

> Agreed... so I'm wondering if OCaml has any provable utility in the
> scripting language space, or if it would be a mistake to try to
> concentrate on that market segment.  It's such a crowded field and OCaml
> is not the best scripting language out there.  OCaml may be a good
> *prototyping* language, but that's not quite the same thing as a good
> scripting language.  Most scripts aren't really prototypes, they're
> throwaways.

I don't think think Ocaml would make a great scripting language.  I think 
it'd do better than C/C++ or Java, but not as well as Perl, Python, Ruby, 
TCL/TK, or Lua.  Did I mention that the scripting language segment is 
incredibly crowded as well?

> 
> The market segment I'm personally interested in is high performance
> computing, ala 3D graphics and AI.  Things that people typically use C++
> for, or might use Lisp for.

If you're willing to use Lisp, I think Ocaml is competitive (Lisp has a 
number of scripting language like features- most importantly, eval.  So 
not all Lisp uses should be supplanted by Ocaml).

> 
> I think OCaml should also chase the "enterprise applications" market, as
> that's where the strong type safety should yield its major advantages
> over C++, Java, and C#.

I agree.  If I knew diddly squat about J2EE, I might be tempted.  My main 
area of interest is in numerical computing.  Note that numerical computing 
is subtly different from gaming.  For one thing, being limited to double 
precision isn't that big of a deal.

> 
> > We can't get 0.2% of the population without getting 0.1% of the
> > population.  We can't get 10% market share without first
> > getting 1% market share.
> 
> True, but you have to state up front that you are *DISSATISFIED* with
> the 0.1% market share.  I have no problem with defining milestones for
> getting from A to Z.  But to accept "we're at A, and that's ok" is
> failure.  Many languages are failures, in this sense.  Lisp, for
> instance, probably got stuck somewhere around M.

Yes.

The current state of software outrages me.  The vast majority of programs 
are crap, to put it bluntly.  They leak memory, segfault when you look at 
them crosseyed, have rampant security holes, are huge, bloated, and slow, 
and many if not most are impossible to maintain.  If you haven't already, 
take a read of this anatomy of a bug at Microsoft:
http://blogs.msdn.com/rick_schaut/archive/2004/05/19/135315.aspx

In addition to a poor process, and a lack of standard tools, this shows a 
code base that is so brittle it's almost impossible to change.  And, as 
much fun as I find beating up on Microsoft to be, the problem isn't 
limited to Microsoft.  Linux is almost as bad.

Ocaml isn't a silver bullet- but it's definately a step in the right 
direction.  I so no bad, and an awful lot of good, comming from widespread 
adoption of Ocaml- as widespread as possible.  I think the closer Ocaml 
comes to complete world domination, the better everything becomes.

-- 
"Usenet is like a herd of performing elephants with diarrhea -- massive,
difficult to redirect, awe-inspiring, entertaining, and a source of
mind-boggling amounts of excrement when you least expect it."
                                - Gene Spafford 
Brian




More information about the Ocaml-biz mailing list