Re: GoTo in Java




In article <43qn0fF1oqu69U1@xxxxxxxxxxxxxx>, "Frank Swarbrick" <Frank.Swarbrick@xxxxxxxxxxxxxx> writes:
>
> To the OCaml guy: What is it specifically that you like about OCaml?

It's relatively safe and expressive, compared to most other languages,
it supports rapid prototyping and other aspects of "agile programming"
and test-driven development, and it doesn't sacrifice performance.

It's relatively safe because it's strongly-typed (with proper OO type
inference), has automatic memory management, has decent encapsulation
and abstraction capabilities (the module system), and has a robust
and convenient error-handling mechanism (exceptions).

It's relatively expressive because it's a functional language that
correctly supports functions as first-class types and higher-order
functions, and because of the pattern-matching operation which is
basic to the ML family of languages.

It supports agile programming by offering an interactive interpreter,
a bytecode compiler, and a native compiler. (Agile programming isn't
a silver bullet, but anything that makes it easier for developers to
experiment with alternate solutions *and* encourages writing unit and
function tests is a useful feature.)

It doesn't sacrifice performance because its expressiveness allows
practitioners to implement highly-efficient approaches with relative
ease, and its native compilers are actually quite good. Obviously
performance depends much more strongly on algorithm, implementation,
and other factors than on language, but Jon Harrop in particular has
made a good case for OCaml's competitiveness in this arena.[1]

> Is it the "functional programming" methodology, the syntax, what?

Certainly the fact that it's a multiparadigm language that includes
proper functional programming (and imperative programming, and OO) is
important. The syntax of the ML family isn't my favorite, but it's
usable.

> The wikipedia page http://en.wikipedia.org/wiki/Ocaml

Ah, Wikipedia - worth every cent you pay to read it.

> says it's popularly used for:
>
> Computer science
> - Theorem proving (e.g. Coq, HOL Light, MetaPRL)
> - Computer program analysis (CIL, C Code Analyzer)
> - Compiler writing (Ocaml compiler, Felix, MTASC)
>
> Natural science
> OCaml is also widely used in physics, chemistry, biology and, more recently,
> bioinformatics:
> - Analysis
> - Visualisation
>
> I don't see anything about financial systems and business rules programming
> in there, which is COBOL's strength.

I've never heard of OCaml being used for business programming (in the
sense that that phrase is typically applied to COBOL).

> Do you envision OCaml being used in
> the same places as COBOL, or do you just like it for other reasons?

No; at any rate, I wouldn't advocate rewriting COBOL in OCaml for the
sake of OCaml. I was advocating replacing the *C* code we use
internally in our products with OCaml.

(Of course, there are some COBOL programs which have little to do with
business rules and don't make particular use of COBOL's strength, and
could well be rewritten in OCaml.)

> Just wondering. Personally I don't yet understand "functional programming",
> but then I haven't made any attempt to learn it. Is it worthwhile in and of
> itself, specific languages aside?

Well, that depends on the value you assign to learning in general,
and to learning computer science and programming techniques in
particular.

There's the opinion in some circles that every programmer would do
well to learn functional programming, if only because it offers a
different look at problem-solving. That might be a little broad -
I'm not sure that sort of generalization is really universally valid.
But I'm an academic, so it's my working assumption that learning *is*
good, in and of itself.

And, personally, I think functional programming is a lot of fun,
though you might want to take that with a grain of salt, since I
think _Critical Inquiry_ is pretty fun, too.

I don't think I'd pick OCaml to learn functional programming, though,
unless I had some use for OCaml in mind. Scheme, a language in the
LISP family, is probably easier and there are good free resources
available. DrScheme[2] is a free, friendly Scheme environment, and
one of the classic introductions to functional programming, _The
Structure and Interpretation of Computer Programs_ (aka "SCIP", "The
Wizard Book"), uses Scheme and is available free online.[3]


1. http://www.ffconsultancy.com/free/ray_tracer/languages.html
2. http://www.drscheme.org/
3. http://mitpress.mit.edu/sicp/


--
Michael Wojcik michael.wojcik@xxxxxxxxxxxxxx

Duck: No secret what's worth a hoot ought to be kept quiet.
Pogo: Secrets is usually perty doggone fascinatin'.
Duck: Egg-zackly ... it's completely illogical to keep a secret secret.
Pogo: An' unfair. -- Walt Kelly
.



Relevant Pages

  • Re: Lambda calculus for dummies?
    ... a pretty hard time with OCaml. ... functional programming has experienced. ... rarely first learn about to program a Turing Machine and then use ... this knowledge to learn an imperative programming language. ...
    (comp.lang.functional)
  • Re: terminology
    ... assignments and procedural programming. ... they had explicitly rejected functional programming for Tutorial D. ... also accepted that Tutorial D wasn't a full blown production language, ... with APL but I have read a fair bit about J and K, ...
    (comp.databases.theory)
  • Re: Minsky still posting
    ... >> interested in new programming languages these days. ... explored in the Japanese Fifth Generation project. ... Functional programming seems to have had a brief flourishing on the back ... language, despite its origins in logic programming. ...
    (comp.lang.prolog)
  • Re: Very poor Lisp performance
    ... > I find that the same typeful programming style (and pattern matching, ... And OCaml is a great language for many tasks, ... this Lisp language... ...
    (comp.lang.lisp)
  • Re: ANN: Q language website (new)
    ... > be simpler than in any other language. ... You do enjoy your OCaml, ... Object-oriented programming has the buzz that ... > You need to be careful when you use the word "polymorphism" as it means ...
    (comp.lang.misc)