Re: speed versus C

From: William Chesters (williamc@dai.ed.ac.uk)
Date: Fri Oct 08 1999 - 02:26:55 MET DST


Date: Fri, 8 Oct 1999 01:26:55 +0100
Message-Id: <199910080026.BAA03378@toy.william.bogus>
From: William Chesters <williamc@dai.ed.ac.uk>
To: Gerd.Stolpmann@darmstadt.netsurf.de
Subject: Re: speed versus C
In-Reply-To: <99100800064700.23684@ice>
 <99100800064700.23684@ice>

Gerd Stolpmann writes:
> >For me, the kind of elegance and beauty you want in a language
> >comes not from constructing castles in the air, but from using
> >abstract ideas to understand the real world better. ocaml says
> >"look, this is what you really mean when you write machine code".
>
> I agree only partly. [...] For example, I cannot even imagine an
> assembler program that uses closures (paraphrased by machine
> instructions); there is always a much simpler way to get the same
> effect.

OK, how about this real life example from the Linux kernel:

        error = file->f_op->read(inode,file,buf,count);

Here, `file' is a faked object, with `vtbl' = `f_op' and `this' passed
in the second argument. And what is a closure if not an object with
one method :-) ? I think this is quite a natural idiom to use, even
in assembler---especially once one has seen how it can be given a nice
meaning within a higher level framework like C++ or indeed Caml.

> I like Caml because it does not waste resources, and because it
> shows how cheap abstraction can be.

I can but agree ... (Though I'd argue that's because it sticks to
abstractions that "ornament" the low-level computational model without
"obscuring" it :-) .)

> I have done some benchmarks in the meantime:

Thanks, they were interesting (I was wrong about vectors being quicker
to construct).



This archive was generated by hypermail 2b29 : Sun Jan 02 2000 - 11:58:26 MET