in reply to Paul Graham on Great Hackers

One professor of mine stated that Perl was a low-level language because the following code snippet for reading lines from a file was fairly slow compared to other languages:
while ( my $line = <FILE> ) { # do something with $line }

Well that's completely nuts, and so out of touch with reality. For a start, the underlying IO system of any decent OS will fetch the disk blocks of the file into memory in advance, especially for a sequential read. And the C library will then fetch the file in chunks of 4096 bytes (or so) at a time, and dole out the bytes line-by-line.

And regardless of any fanciness the OS and C library and Perl IO layers try to do, I/O IS SLOW! It doesn't matter if your snipper is sub-optimal, because its slowness will be lost in the noise. I really fail to see the professor's point: that snippet abstracts away the concepts of hard disks and buffers quite well in my opinion. I must be missing something.

- another intruder with the mooring of the heat of the Perl

Replies are listed 'Best First'.
Re^2: Paul Graham on Great Hackers
by VSarkiss (Monsignor) on Jul 29, 2004 at 19:13 UTC

    Well that's completely nuts, and so out of touch with reality

    Indeed. That was exactly my reaction. In fact, I completely fail to see the connection between "slow I/O loop" (whatever that means) and "low-level language". If one implies the other, then because I can write a tight I/O loop in ASM, does that mean assembler is not a low-level language?

    I always believed high- and low-level refer to the ease of expressing complex ideas in a programming language, not to I/O speed -- or any other kind of speed, for that matter. On that score, Perl is squarely in the high-level language camp.