C in Science and Engineering...

N

Nick Keighley

    NK> On 5 June, 21:44, jacob navia <[email protected]> wrote:

JN > Perl is write only software. Write it, use it once or twice,
JN > then forget it...
JN > Nobody will be able to debug it, or to understand it later.
    NK> this isn't actually true. Or needn't be true

Why should being *true* or *false* get in the way of anything Mr. Navia
chooses to believe?

I was addressing the lurkers
 
T

Tim Streater

Nick Keighley said:
JN > Perl is write only software. Write it, use it once or twice,
JN > then forget it...
JN > Nobody will be able to debug it, or to understand it later.


I was addressing the lurkers

Perl is too full of regexes and funny symbols to be, in general,
readable and understandable.
 
K

Keith Thompson

Tim Streater said:
Perl is too full of regexes and funny symbols to be, in general,
readable and understandable.

That's your opinion. (And yes, the fact that it was written over
your signature is sufficient to establish that, so

My point is that well-written Perl code can be perfectly
understandable *to someone who knows the language*.

Exactly the same thing is true of C.

C code can look like line noise to someone who doesn't know the
language. Deliberately obfuscated C can look like line noise even
to someone who does know the language. And yet, it's entirely
possible to write readable and maintainable C code, assuming the
target audience knows the language and its idioms reasonably well.

Substitute Perl for C in the preceding paragraph, and it's still
equally true. (I know both C and Perl reasonably well, and
I personally find them to be about equally readable.)

I'm not asking you to like Perl (if I were, this wouldn't be the
place for it), but please consider that the ugliness of *any*
language depends largely on the reader's familiarity with it.
 
R

Richard Bos

Rui Maciel said:
That doesn't make any sense. Are you actually claiming that people
whose living consists of writing software are not interested in
writing software?

In the same way that people who make a living writing articles for
scientific magazines are usually not that interested in language, yes.
They're interested in the scientific content, not in the medium through
which it is propagated.

Richard
 
N

Nick Keighley

Perl is too full of regexes and funny symbols to be, in general,
readable and understandable.

that was exactly my reaction to C when I first saw it. I'm a former
Pascal programmer.

Hell, I'm not even that big a fan of Perl. But in its own niche it's
excellent. If I want to match regexps how do I do it? Is there a C
library that does this without using arcane symbols?
 
J

jacob navia

Charlton Wilbur a écrit :
Don't worry - I've seen Jacob frothing at the mouth before, and I am
prepared to accord to him exactly as much credibility as he's earned.


:)

Thanks
 
T

Tom St Denis

Perl is too full of regexes and funny symbols to be, in general,
readable and understandable.

While I agree there is a lot of indecipherable perl out there, the
language does support whitespace and comments. I use it when I need
to script a test suite since I can mash around natural language
strings a lot easier than in C. The trick is to not turn your perl
programs into IOCCC-esque entries.

Tom
 
B

bart.c

Tom said:
While I agree there is a lot of indecipherable perl out there, the
language does support whitespace and comments. I use it when I need
to script a test suite since I can mash around natural language
strings a lot easier than in C.

Thats like the point I was trying to make, not very successfully.

Let's try turning it around: if these easy, dynamic languages were faster
than C, how many people would still be programming in it? Would there be any
point?
 
T

Tim Harig

I agree with this 100%. Any tool can be misused and abused. That said,
I have never been able to bring myself to like the language even though
I am fully aware of its power of expression; and that is from somebody
who is know to write quite a bit of awk. There is just something about
the language that tends to turn many of us off in a way not no other
language that I have encountered has managed. That isn't a functional
deficiency, it is a matter of personal taste. I am not too fond of C
code written in Hungarian notation either; but, I can understand why
some people might find it useful.
Let's try turning it around: if these easy, dynamic languages were faster
than C, how many people would still be programming in it? Would there be any
point?

1. Most of the dynamic languages require interpretation (or at the very
least some kind of embedded runtime). Most of those interpreters
are written in C. There are just some things that *require*
low level language support. Even for higher level support,
most dynamic langauges still require wrappers to access basic
system level calls that are usually implemented as C interfaces.

Then again, there are always those who claim they can write an
operating system in these languages. I am always left to wonder
what is running the interperator that such an operating system
runs on.

2. Having the ability to organize and access memory directly through the
use of pointers and pointer arithmetic can lead to some very
powerful data structures that cannot as easily or expressively
be created using higher level constructs.
 
N

Nick Keighley

criticising Perl for being full of regexps is a bit like complaining
about the sea for having fish in it.
Thats like the point I was trying to make, not very successfully.

Let's try turning it around: if these easy, dynamic languages were faster
than C, how many people would still be programming in it? Would there be any
point?

C would still have wide availability, low level bit banging,
portability, and historical inertia on its side. Often the very things
that make these scripting languages cool is also what makes them slow.

Perl is also a bit of a conceptual mess
 
D

Default User

Rui Maciel said:
chutsu wrote:
I haven't found a single person using python or ruby for serious science
and engineering
applications. The ones I'm familiar with tend to use either fortran, C or
matlab, and in some rare
cases even C++.

Depends on what you mean by "serious". I work in R&D for an aerospace
company. That means a lot of prototype, proof-of-concept work. The most
common languages are C++ and Java, with C still in the mix. I'm going to
have to do some work this time out with C#. At least one of our developers,
who's a hardware guy more than anything, likes Python. I haven't seen anyone
do much new development in Fortran in a long time.



Brian
 
S

Seebs

Let's try turning it around: if these easy, dynamic languages were faster
than C, how many people would still be programming in it? Would there be any
point?

A few, and yes there would -- device drivers, etc.

-s
 
T

Tim Streater

Tom St Denis said:
While I agree there is a lot of indecipherable perl out there,

Certainly, and I'm in the fortunate position of no longer needing to
have anything to do with any of it.
the language does support whitespace and comments.

I haven't yet found a switch I can set on the programmers, though, to
make them use this feature.
I use it when I need to script a test suite since I can mash
around natural language strings a lot easier than in C. The
trick is to not turn your perl programs into IOCCC-esque entries.

I use PHP for everything these days as it's much more readable. Mind
you, a dedicated person can write FORTRAN in any language, which is to
say we're not proof against those toads who think it's "neat" and "cool"
to use the obscure language features of perl. The one time I dipped into
the perl ng, to ask a question about parameter passing, I was told to
push off as they were all too busy with a competition about finding
better ways to reduce their programs to nothing but a .
 
T

Tim Streater

Nick Keighley said:
criticising Perl for being full of regexps is a bit like complaining
about the sea for having fish in it.

Sharks. And it would be a valid complaint if you had to swim in it.

No, perhaps not. But that's not the case, if the remarks posted here are
to be believed (and why should I doubt them).

I've mentioned particle physicists and their concerns about floating
point. This was always why they used FORTAN, historically; now they
apparently use C++.

These people have *serious* amounts of data. The company I last worked
for was responsible for configuring, for CERN, some 15 or so 10Gbps
circuits from CERN to individual physics labs around Europe. This is so
the LHC data can be distributed for processing. At CERN itself there are
farms of hundreds of PCs doing data analysis. Slow scripting languages
are not going to cut it.
C would still have wide availability, low level bit banging,
portability, and historical inertia on its side. Often the very things
that make these scripting languages cool is also what makes them slow.

Perl is also a bit of a conceptual mess

You might say that but I couldn't possibly comment.
 
T

Tim Streater

Nick Keighley said:
that was exactly my reaction to C when I first saw it. I'm a former
Pascal programmer.

:)

I got off Pascal as soon as I possibly could, but I was disappointed by
some parts of C when I started to use it in about 1085. But it was the
best game in town at the time, and were I to again be doing what I was
doing at that time, I'd probably use it again.
Hell, I'm not even that big a fan of Perl. But in its own niche it's
excellent. If I want to match regexps how do I do it? Is there a C
library that does this without using arcane symbols?

My solution to regexps is not to do them.
 
T

Tim Streater

Tim Streater said:
I got off Pascal as soon as I possibly could, but I was disappointed by
some parts of C when I started to use it in about 1085.

Oh, nice typo. Yes, I came over the C with WIlliam the Conqueror.
 
B

bart.c

I've mentioned particle physicists and their concerns about floating
point. This was always why they used FORTAN, historically; now they
apparently use C++.

These people have *serious* amounts of data. The company I last worked
for was responsible for configuring, for CERN, some 15 or so 10Gbps
circuits from CERN to individual physics labs around Europe. This is so
the LHC data can be distributed for processing. At CERN itself there are
farms of hundreds of PCs doing data analysis. Slow scripting languages
are not going to cut it.

I'm sure scripting languages do form part of such projects (even if it's
just to schedule the programs proper rather than do the actual work).

I added scripting languages into my applications years ago. They made life
much, much easier (for example, by being able to develop modules while
actually running the application (no need to save data and settings, quit,
edit, compile, link, run, load the data again, create the same environment,
and eventually get back to the problem area if you haven't totally forgotten
what it was).

I reckoned if a scripted program was only between one and two times slower
than a compiled version (where the execution time was even significant),
then that was a sensible use of scripted over compiled.

And because this was a custom language, it knew about the sort of
calculations I was interested in (3D graphics), and had suitable datatypes
and operations ready made; multiplying two matrices was as simple as a=b*c
and about the same speed as compiled code.

I'm now interested in making such languages faster so they can take over
more tasks (with my stuff, I'm probably already at 75% (that will run no
slower than half the speed of compiled code, or is not significant), and
trying to push that to 100%).

Anyway, it's not just a question of choosing between C or C++, or Ruby at
300-400x slowdown (if you believe some people). The options are wider than
that.

$, @ and # everywhere put me off.
 
J

jacob navia

Nick Keighley a écrit :
Don't use a switch. Use a horse whip.

Instead of talking like this have you EVER reflected on
why comments are absent from throw-away software?

Perl scripts are used for "write once use twice" code. Everybody
knows that, and writing comments on such code is seen as a waste
of time.

But as always, perl scripts tend to be used far more than their
writers thought it would be possible.
 
N

Nick Keighley

Nick Keighley a crit :


Instead of talking like this

it's like a joke

have you EVER reflected on
why comments are absent from throw-away software?

my throw-away code sometimes has comments. I tend to keep so-called
throw-away code in case I have to do something similar again.
Perl scripts are used for "write once use twice" code.
Everybody
knows that, and writing comments on such code is seen as a waste
of time.

But as always, perl scripts tend to be used far more than their
writers thought it would be possible.

quite substantial programs get written in Perl. Sometimes
intentionally. And sometimes with comments.

For instance:-


#!/opt/perl5/perl

# $Id: XXX.pl 253 2008-02-15 09:35:20Z XXX$
# This script file creates (or restores) the XXX database and
appropriate data files
# and logs all actions to $admin/XXXdirectory
#
# Usage: perl XXX.pl [-Q] [-I] [-V] [-CREATE | -CREATEINACTIVE | -
DELETE | -RESTORE [restorePath]] [-TEST]
#
# Command line options:
#
# -Q Quiet mode; STDOUT supressed. -Q is incompatible with -I
and -V.
#
# -I Interactive mode; some questions are asked to the user.
Note: even
# if -I is disabled, there are some questions that must be
asked to the user. -I
# and -Q are incompatible.
#
# -V Verbose mode. -V and -Q are incompatible.
#
# -NQ NO to QUERIES mode. If selected, the program automatically
assumes a 'NO' answer to
# each of the update requests. Only the database is updated
in this mode.
#
# -CREATE Create XXX database. Previous instance of the database (if
# exists) will be automatically deleted. (ignore errors
about stopping/starting
# services, that can be due to a previuos corrupted
configuration)


[and so on...]

the code itself was reasonably well commented as well
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,432
Messages
2,571,682
Members
48,796
Latest member
Greg L.

Latest Threads

Top