Version française
Home     About     Download     Resources     Contact us    
Browse thread
speed versus C
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: William Chesters <williamc@d...>
Subject: Re: speed versus C
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).