:: [DNG] OT: OCaml and Modula 3
Pàgina inicial
Delete this message
Reply to this message
Autor: Hendrik Boom
Data:  
A: Steve Litt, dng
Assumpte: [DNG] OT: OCaml and Modula 3
On Sun, Jul 03, 2016 at 07:24:04PM -0400, Steve Litt wrote:
> On Sun, 3 Jul 2016 17:17:35 -0400
> Hendrik Boom <hendrik@???> wrote:
>
> > On Fri, Jun 24, 2016 at 01:36:14PM -0400, Peter Olson wrote:
> >
> > >
> > > Can I download your compiler that fixes all my mistakes? I could
> > > really use such a tool.
> >
> > Yes, as a matter of fat you can -- almost.
> >
> > Two languages I use have the property that once the program gets
> > through the compiler, almost all the bugs are gone.
> >
> > Modula 3.
> > OCaml.
>
> OFFLIST
>
> Hi Hendrick,
>
> Does either have addon libraries for things like GUI, XML, and YAML? Do
> both have a command to run a shellscript, like fork(), exec(),
> system()? Do you use either of them a lot? Which do you use more? Do
> you like them? Which do you like more?


I haven't investigated its libraries much, ans still feel very much
like a beginner with OCaml, but at least one OCaml program I
use does use a UI library; I think GTK. It makes graphical
representations of history graphs in the monotone revision control
system.

OCaml does have an XML reading library; in fact there's an Oaml
variant with extra syntax for queries to an XML database.
Unfortunately it lacks a relational join.
Not familiar with YAML at all.

fork() et al? See
http://caml.inria.fr/pub/docs/manual-ocaml/libunix.html
for the whole list.

The package manager for OCaml source packages is OPAM. (in fact, on
Debian the recommended way to install ocaml seems to be to install
opam. THe command opam -a gives a list for all the packages available
for your current version of ocaml. I tried it and got a list of 7172
lines, eash a one-line package description.

Unfortunately, the list of packages is not well curated, and I've had
trouble using the more obscure ones.

> Is either used by real people to do real things? I thought I heard that
> to be a modern Wall Street Whiz Kid today you need to learn OCaml.


Yes. I believe the company that's most involved in the use and
development of OCaml is OCaml is Jane Street. I suspect it's because
mistakes in their code can easily be very, very expensive.

OCaml is a statically typed language that figures out the types by
sophisticated reasoning. This leads to an (I think deplorable) style
whereby the programmer usually doesn't specify types and llsts the
system figure them out. Of course you *can* specify types explicitly
whenever you care to; its just that lazy programmers don't. making
their code less than readable.

I find OCaml insufficiently wordy.

>
> Back in another lifetime, I was a professional Pascal programmer. Not
> Borland Pascal, real Pascal that wouldn't let you do anything. I didn't
> appreciate the restrictions, but I sure appreciated the heads-up every
> time I was about to do something stupid.


I've used it. At the time, the language looked as if it would allow
you to think in high-level concepts, but when you actually ggot to an
implementation, everything was restrictd so you had to thin in macine
terms. For example, on the original and canonical implementatino onf
the CDC 6000 series, you couldn't have a set of characters because
there were 64 characters avilable and the machine had a 60-bit machine
word.

Modula 3 is based on Modula 2, but it is not a Wirth-designed language,
and it does not share its restrictions. It has a full panoply of
ordinary features, such as dynamic arrays, records, and so foth, and
it also has a full set of object-oriented stuff. The object stuff in
independent of the module structure.

Modula 3 has been used to write an operating system (called SPIN).
It is a full-fledged systems language.

It is type-safe (unless you explicitly use UNSAFE features (and you
have to use the keyword UNSAFE for this), and has a garbage collector.
malloc and free-style memory allocation is availale if you need it, but
it is UNSAFE.

But it seems to be in decline these days, undeservedly so.

I find it (like Pascal) excessively wordy.

-- hendrik